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. At times, you might need more control than that offered by the native functionality of a control, however. Visual C# .NET supports six events that enable you to deal with mouse input directly. These events are listed in Table 17.5, in the order in which they occur.

Table 17.5. Events Used to Handle Mouse Input
Event NameDescription
MouseEnterOccurs when the pointer enters a control.
MouseMoveOccurs when the pointer moves over a control.
MouseHoverOccurs when the pointer hovers over a control.
MouseDownOccurs when the pointer is over a control and a button is pressed.
MouseUpOccurs when the pointer ...

Get Sams Teach Yourself Microsoft® Visual C#™ .NET 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.