0
  • I have a panel and have added a PictureBox to it.
  • I have added mouse_click listeners to both the panel and the picturebox.
  • When they are clicked i create a messagebox which tells me the mouse position.

Problem:

  • When i click the panel, i get the mouse position i want.
  • When i click the pictureBox, i get the current position in that picturebox.

What i want:

  • I want both of the controls to get the current mouseposition on the form.
  • I can also go with getting the current mouseposition of the panel, since it is overlaying the form.

Does anybody know how i can do this? I've googled around for this, but can't seem to find anything about it.

Thank you in advance.

2 Answers 2

4

see PointToScreen and PointToClient methods on the control.

0
0

If you want the position from the entire form just add the width and height of those items to your point.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.