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.

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 Point Point

相對於這個項目的點值。The point value, as relative to this element.

relativeTo
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針對relativeTo允許,而且表示座標應該相對於這個項目所屬的邏輯樹狀結構中的根項目。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.

適用於