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.

abatishchev
  • 98,240
  • 88
  • 296
  • 433
Ikky
  • 2,826
  • 14
  • 47
  • 68

2 Answers2

4

see PointToScreen and PointToClient methods on the control.

0

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

Icono123
  • 3,830
  • 3
  • 21
  • 20