disable context menu for text boxes

  • Thread starter Thread starter Henrik
  • Start date Start date
H

Henrik

Hi,

If one right-clicks in a text box, a context menu is
displayed with the usual options (cut, copy, paste et.c.).
Is there any way to disable this?
I have my own textbox like this:

public class MyTextBox : System.Windows.Forms.TextBox
{
public MyTextBox()
{
this.ContextMenu = null;
}

....
}

However, this doesn't work. It works fine for forms though
(setting it to null removes the menu).

Is there any other way to do it?


Thanks,

Henrik
 
* "Henrik said:
If one right-clicks in a text box, a context menu is
displayed with the usual options (cut, copy, paste et.c.).
Is there any way to disable this?
I have my own textbox like this:

public class MyTextBox : System.Windows.Forms.TextBox
{
public MyTextBox()
{
this.ContextMenu = null;
}

....
}

However, this doesn't work. It works fine for forms though
(setting it to null removes the menu).

Override the control's 'WndProc' and listen for 'WM_CONTEXTMENU'.
 
Back
Top