UIElement.TranslatePoint(Point, UIElement) 方法

定义

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

public:
 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

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

relativeTo
UIElement

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

返回

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

注解

允许传递 relativeTonull,并指示坐标应相对于此元素所属的逻辑树中的根元素。Passing 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.

适用于