[英]c# wpf - Can I get the coordinates to a pixel clicked in an image control
I have an Image control running in my MainWindow.xaml, I was wondering if I can get the X and Y coordinates to the pixel clicked from the RoutedEventArgs on the MouseUp event for the control? 我的MainWindow.xaml中有一个Image控件正在运行,我想知道是否可以获取该控件的MouseUp事件上从RoutedEventArgs单击的像素的X和Y坐标? I don't need the color or anything at that pixel, I would just like to know where that pixel was.
我不需要该像素的颜色或其他任何东西,我只想知道该像素在哪里。 Thank you for the help.
感谢您的帮助。
You can try handling the MouseLeftButtonUp
event: 您可以尝试处理
MouseLeftButtonUp
事件:
private void image1_MouseLeftButtonUp(object sender, MouseButtonEventArgs e){
Point pos = e.GetPosition(image1);
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.