I am trying to make a minesweeper type game in visual c# and I want to have different things happen when I right click and left click a button, how do I do this?
I have tried this code but it only registers left clicks:
private void button1_MouseClick(object sender, MouseEventArgs e)
{
if (e.Button == System.Windows.Forms.MouseButtons.Left)
{
MessageBox.Show("Left");
}
if (e.Button == System.Windows.Forms.MouseButtons.Right)
{
MessageBox.Show("Right");
}
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…