public Point TranslatePoint(
	Point point,
	UIElement relativeTo
)
 
private void OnMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
    // Retrieve the coordinate of the mouse position.
    Point pt = e.GetPosition((UIElement)sender);

    // Perform the hit test against a given portion of the visual object tree.
    HitTestResult result = VisualTreeHelper.HitTest(myCanvas, pt);

    if (result != null)
    {
        // Perform action on hit visual object.
    }
}
 
 

相关文章:

  • 2021-05-20
  • 2021-10-02
  • 2021-05-10
  • 2021-09-03
  • 2021-07-14
  • 2022-02-17
猜你喜欢
  • 2021-01-24
相关资源
相似解决方案