winform 右键单击事件

 1 private void Form1_MouseClick(object sender, MouseEventArgs e)  
2 {
3 if (e.Button == MouseButtons.Left && e.Clicks == 1)
4 {
5 this.label1.Text = "您单击了鼠标左键!";
6 }
7 else if (e.Button == MouseButtons.Right && e.Clicks == 1)
8 {
9 this.label1.Text = "您单击了鼠标右键!";
10 }
11 }


你可能感兴趣的:(WinForm)