0

In order to work with an image I need to make the user select certain(4) coordinates within a Image Box and afterwards save that coordinate data and close the window. The project is using C# and WPF. Sadly google is giving me a lot of unfocused solutions on this topic. Any suggestions/ links?

thanks

fk2
  • 739
  • 1
  • 14
  • 30
  • 1
    have you looked at this older post on SO? http://stackoverflow.com/questions/4226740/how-do-i-get-the-current-mouse-coordinates-in-wpf – Xcalibur37 Dec 23 '11 at 02:38

1 Answers1

1

Point pos = Mouse.GetPosition(myElement); will give you the mouse position relative to the element.

Tomislav Markovski
  • 12,331
  • 7
  • 50
  • 72
  • Okay, so I do: `private void Control1_MouseClick(Object sender, MouseEventArgs e) { Point pos = Mouse.GetPosition(myElement); }` ? But won't the mouse move after the click, and be at another position while my event is still firing off? – fk2 Dec 23 '11 at 20:00
  • It will. Your mouse will always move and be at different positions. At what time do you want the positions captured? – Tomislav Markovski Dec 23 '11 at 20:54
  • at the precise moment of the click – fk2 Dec 23 '11 at 21:18
  • 1
    Use the event MouseLeftButtonDown, and get the position from e.GetPosition(element) – Tomislav Markovski Dec 23 '11 at 21:26