How to "completely" Close the right-click menu of textbox?
Assign an empty menu to the contextmenu of textbox. Right-click the textbox and the default menu does not appear. However, if you right-click the textbox and hold it down, move the mouse outside the textbox and release it, the default menu is displayed. This is a question from a netizen. I used C # and VB. NET to implement the following methods:
Wm_contextmenu = 0x007b; // send this message when you right-click a window
C #:
Using system;
Using system. drawing;
Using system. Windows. forms;
Namespace manuapp
{
/// <Summary>
/// Summary of textboxnomanu.
/// </Summary>
Public class textboxnomanu: system. Windows. Forms. textbox
{
Public textboxnomanu ()
{
//
// Todo: add the constructor logic here
//
}
Protected override void wndproc (ref message m)
{
If (M. MSG! = 0x007b)
{
Base. wndproc (ref m );
}
}
}
}
VB. NET:
Public class textboxex
Inherits system. Windows. Forms. textbox
Public sub new ()
Mybase. New ()
End sub
Protected overrides sub wndproc (byref M as system. Windows. Forms. Message)
If M. MSG <> & then B then
Mybase. wndproc (m)
End if
End sub
End Class