Welcome to WindowsClient.net | Sign in | Join

Here are some frequently asked questions about Windows Forms and their answers.

Windows Forms FAQs

How do I get the mouse cursor position in my control's client coordinates?

Use the Position property of the Cursor class found in the System.Windows.Forms namespace. Here is code that will flag whether the mouse is over button1.

Point point = PointToClient( Cursor.Position ); 
bool mouseIsOverButton1 = button1.Bounds.Contains( point );

Contributed from George Shepherd's Windows Forms FAQ