Get the current mouse location (Screen and Client)

To get the current mouse position use the static method Control.MousePosition

It returns a Point structure in screen coordinates. Use PointToClient method of the control to map it to client coordinates.

Example:

Point cp = panel1.PointToClient(Control.MousePosition);

Note:
The PointToClient result may be outside the control’s bounding area if the mouse was not above the control.

Lastest update in May 2011, inital post in May 2011

Write a comment

I appreciate comments, suggestions, compliments etc. Unfortunately I have no time to reply to them. Useful input will be used for sure!