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.
}
}
WPF草稿
时间: 2024-10-29 06:48:46