Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove the default context menu of a TextBox Control? C#

Tags:

c#

winforms

How to remove the default context menu of a TextBox Control?

alt text

Is there a property to disable it?
Thanks :)

like image 965
yonan2236 Avatar asked Nov 03 '10 01:11

yonan2236


People also ask

What is context menu in C#?

C# context menus are the menus that pop up when the user clicks with the right hand mouse button over a control or area in a Windows based form. They are called context menus because the menu is usually specific to the object over which the mouse was clicked.


2 Answers

You can also set the ShortcutsEnabled property to false. This removes the default context menu and all clipboard functionality. I presume that's why you're trying to suppress the menu? I can't think of any good reason other than purposefully preventing your users from using copy/paste.

like image 84
Bradley Smith Avatar answered Oct 26 '22 22:10

Bradley Smith


Try setting the ContextMenu property of the TextBox to a dummy, empty ContextMenu instance.

like image 34
gcores Avatar answered Oct 26 '22 22:10

gcores