Frage

I just found out that there are 4 similarly names events for NotifyIcon named Click, DoubleClick, MouseClick and MouseDoubleClick. The description text for them says

Occurs when the component is (double-)clicked [with mouse].

But what else can you click elements with except mouse?

I tried clicking it with mouse and pressing Enter after some tricky selection stuff with arrow keys and tabbing. Clicking with mouse fires both events, but pressing Enter only fires the Click event.

What other differences are between these two pairs of events?

War es hilfreich?

Lösung

Assuming you're referring to WinForm Control events, from the MSDN documentation for Control.Click:

A click can be caused by not only a mouse click, but also some events like a pressed key, etc.

The 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 MouseClick event. However, the 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.

  • Click Event

The 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 MouseClick event. However, the 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.

  • Mouse Click Event

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.

Source

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top