/* * C# QUICK TIPS //'Trapping Mouse Buttons //'Create a MouseDown event handler for the form, button, control of your choice. I created one for the form. //'When you click on the form with the mouse, the correct button is detected! */ using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; namespace Trapping_Mouse_Buttons { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_MouseDown(object sender, MouseEventArgs e) { switch (e.Button) { case MouseButtons.Left: MessageBox.Show("You clicked the left button"); break; case MouseButtons.Middle: MessageBox.Show("You clicked the middle button"); break; case MouseButtons.Right: MessageBox.Show("You clicked the right button"); break; } } } }