Form cursor X and Y pixel coordinates

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top