C# 点击鼠标右键引发的事件

运用button的MouseDown事件,来判断是点了鼠标左键或右键,例子如下:
private void button1_MouseDown(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Left)
            {
                MessageBox.Show("left");
            }
            else
            {
                MessageBox.Show("right");
            }
        }

你可能感兴趣的:(c#学习)