System.Windows.Forms.Control.Click Event

Occurs when the control is clicked.

Syntax

public event EventHandler Click

Remarks

The Control.Click event passes an EventArgs to its event handler, so it only indicates that a click has occurred. If you need more specific mouse information (button, number of clicks, wheel rotation, or location), use the Control.MouseClick event. However, the Control.MouseClick event will not be raised if the click is caused by action other than that of the mouse, such as pressing the ENTER key.

A double-click is determined by the mouse settings of the user's operating system. The user can set the time between clicks of a mouse button that should be considered a double-click rather than two clicks. The Control.Click event is raised every time a control is double-clicked. For example, if you have event handlers for the Control.Click and Control.DoubleClick events of a System.Windows.Forms.Form, the Control.Click and Control.DoubleClick events are raised when the form is double-clicked and both methods are called. If a control is double-clicked and that control does not support the Control.DoubleClick event, the Control.Click event might be raised twice.

You must set the StandardClick value of System.Windows.Forms.ControlStyles to true for this event to be raised.

Note:

The following events are not raised for the System.Windows.Forms.TabControl class unless there is at least one System.Windows.Forms.TabPage in the TabControl.TabPages collection: Control.Click, Control.DoubleClick, Control.MouseDown, Control.MouseUp, Control.MouseHover, Control.MouseEnter, Control.MouseLeave and Control.MouseMove. If there is at least one System.Windows.Forms.TabPage in the collection, and the user interacts with the tab control's header (where the System.Windows.Forms.TabPage names appear), the System.Windows.Forms.TabControl raises the appropriate event. However, if the user interaction is within the client area of the tab page, the System.Windows.Forms.TabPage raises the appropriate event.

For more information about handling events, see Consuming Events.

Requirements

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0