拖个contextMenuStrip控件
按钮的MouseDown事件:
private void treeView1_MouseDown(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Right)//此处为右击
{
contextMenuStrip1.Show(this, new Point(e.X, e.Y));
}
}
时间: 2024-11-05 19:43:42