How is it possible to get the forms mouseposition when clicking inside a control?

Posted by ikky on Stack Overflow See other posts from Stack Overflow or by ikky
Published on 2010-03-30T15:04:27Z Indexed on 2010/03/30 16:23 UTC
Read the original article Hit count: 330

Hi.

  • 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.

© Stack Overflow or respective owner

Related posts about c#

Related posts about compact-framework