Control.MouseClick Event


Occurs when the control is clicked by the mouse.

Namespace:   System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)

public event MouseEventHandler MouseClick

Depressing a mouse button when the cursor is over a control typically raises the following series of events from the control:

  1. MouseDown event.

  2. Click event.

  3. MouseClick event.

  4. MouseUp event.

For this to occur, the various events cannot be disabled in the control's class.

Two single clicks that occur close enough in time, as determined by the mouse settings of the user's operating system, will generate a MouseDoubleClick event instead of the second MouseClick event.


Click events are logically higher-level events of a control. They are often raised by other actions, such as pressing the ENTER key when the control has focus.


The following code example demonstrates the use of this member. In the example, an event handler reports on the occurrence of the MouseClick event. This report helps you to learn when the event occurs and can assist you in debugging. To report on multiple events or on events that occur frequently, consider replacing MessageBox.Show with Console.WriteLine or appending the message to a multiline TextBox.


private void Control1_MouseClick(Object sender, MouseEventArgs e) {

System.Text.StringBuilder messageBoxCS = new System.Text.StringBuilder();
messageBoxCS.AppendFormat("{0} = {1}", "Clicks", e.Clicks );
messageBoxCS.AppendFormat("{0} = {1}", "X", e.X );
messageBoxCS.AppendFormat("{0} = {1}", "Y", e.Y );
messageBoxCS.AppendFormat("{0} = {1}", "Delta", e.Delta );
messageBoxCS.AppendFormat("{0} = {1}", "Location", e.Location );
MessageBox.Show(messageBoxCS.ToString(), "MouseClick Event" );

.NET Framework
Available since 2.0
Return to top