WPF - How to get canvas position on mouse click independently of the resolution and resizing
- 阅读更多 关于 WPF - How to get canvas position on mouse click independently of the resolution and resizing
问题 I found a lot on this subject for HTML 5 JavaScript (like so), but I have found nothing over WPF. I have a canvas that we are creating for selecting points over a image in that canvas. The canvas element in XAML is very simple: <Canvas x:Name="Cnv" Grid.Column="1" Grid.Row="1" /> We are getting the coordinates from mouse click like so: Point p = Mouse.GetPosition(Cnv); Then, we draw something on that point: ellipse = new Ellipse(); ellipse.Fill = Brushes.Transparent; ellipse.Width = 20;