Form cursor X and Y pixel coordinates

  • Thread starter Thread starter Dan H.
  • Start date Start date
D

Dan H.

Hello,
I want to try to retrieve the cursor position x and y relative to the form
the cursor is over.

The way I am doing it now is:

1. Retrieve the left and top position of the form relative to the desktop
2. Retrieve the desktop cursor position.
3. Take the difference of the forms left and top position. Adjust the
desktop cursor position based on this.

Is there an easier way? Is there a property within System.Windows.Forms
/controls that already calculates this?

Sorry if this is a stupid question.

Sincerely,

Dan
 
Back
Top