private void MyControl_MouseClick(object sender, MouseEventArgs e) { string mouseClickDetails = e.ToString(); Console.WriteLine(mouseClickDetails); }
private void MyControl_MouseMove(object sender, MouseEventArgs e) { this.Text = e.ToString(); }In this example, when the mouse pointer is moved over the MyControl, the x, y coordinates and the button type of the MouseEventArgs object are displayed in the form's title bar. The MouseEventArgs class is a part of the System.Windows.Forms namespace in the .NET Framework Class Library.