继承一个TextBox
public class text : System.Windows.Forms.TextBox
{
const int WM_RBUTTONDOWN = 0x0204;
protected override void WndProc(ref System.Windows.Forms.Message m) { if(m.Msg == WM_RBUTTONDOWN) return; base.WndProc(ref m); } 
}

解决方案 »

  1.   

    这样做可能复杂一点,有简单一点的,不用继承
    private void textBox1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
    {
    ContextMenu menu1=new ContextMenu();
    textBox1.ContextMenu =menu1;
    }
      

  2.   

    为什么不在IDE的环境中添加一个呢???
    在窗体上拖出一个ContextMenu,名称为contextMenu1,对contextMenu1进行设计,把TextBox的ContextMenu属性设定为contextMenu1,就可以了。
      

  3.   

    同意w_shd(酸辣粉).在窗口上添加一个contextMenu1组件,不要建立任何子项。
    在需要的textBox的contextMenu属性上选择建立的这个contextMenu1