实现效果:
知识运用:
MouseEventArgs类的Button属性 TextBox控件的ContextMenu属性
实现代码:
private void textBox1_MouseDown(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Right) textBox1.ContextMenu = new ContextMenu(); }