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.