Using the Common Mouse Events

As with keyboard input, most controls support mouse input natively; you don't have to write code to deal with mouse input. However, at times you need more control than that offered by the native functionality of a control. C# supports six events that enable you to deal with mouse input directly. These events are listed in Table 18.5, in the order in which they occur.

Table 18.5. Events Used to Handle Mouse Input
Event Name Description
MouseEnter Occurs when the pointer enters a control.
MouseMove Occurs when the pointer moves over a control.
MouseHover Occurs when the pointer hovers over a control.
MouseDown Occurs when the pointer is over a control and a button is pressed.
MouseUp Occurs when the pointer is over ...

Get Sams Teach Yourself C#™ in 24 Hours now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.