UIElement.TranslatePoint(Point, UIElement) UIElement.TranslatePoint(Point, UIElement) UIElement.TranslatePoint(Point, UIElement) Method


将相对于此元素的点转换为相对于指定元素的坐标。Translates a point relative to this element to coordinates that are relative to the specified element.

 System::Windows::Point TranslatePoint(System::Windows::Point point, System::Windows::UIElement ^ relativeTo);
public System.Windows.Point TranslatePoint (System.Windows.Point point, System.Windows.UIElement relativeTo);
member this.TranslatePoint : System.Windows.Point * System.Windows.UIElement -> System.Windows.Point


Point Point Point

相对于此元素的点值。The point value, as relative to this element.

UIElement UIElement UIElement

给定点转换后的元素。The element to translate the given point into.


相对于目标元素而不是此源元素的点值。A point value, now relative to the target element rather than this source element.


允许传递null , 并指示坐标应相对于此元素所属的逻辑树中的根元素。 relativeToPassing null for relativeTo is permitted, and indicates that coordinates should be relative to the root element in the logical tree that this element belongs to.

此方法用于转换命中测试点值。This method is used for translating hit test point values. 如果正在创作控件并且需要在较低级别处理输入, 则调用此方法主要是相关的。Calling this method is mainly relevant if you are authoring a control and need to process input at a lower level. 如果使用的是现有控件, 通常可以假定已完成的控件将报告正确转换的命中测试结果。If you are using existing controls, you can generally assume that completed controls will report correctly translated hit test results.