实现效果:

  在TextBox控件中禁用鼠标右键-LMLPHP

知识运用:

  MouseEventArgs类的Button属性     TextBox控件的ContextMenu属性

实现代码:

        private void textBox1_MouseDown(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Right)
textBox1.ContextMenu = new ContextMenu();
}

  

05-11 13:01