UIElement.TranslatePoint(Point, UIElement) 方法

定義

將相對於這個項目的點轉換成相對於指定項目的座標。

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
Public Function TranslatePoint (point As Point, relativeTo As UIElement) As Point

參數

point
Point

相對於這個項目的點值。

relativeTo
UIElement

指定的點要轉換成的項目。

傳回

Point

點值,現在會相對於目標項目,而不是這個來源項目。

備註

null relativeTo 允許傳遞 ,並指出座標應該相對於這個專案所屬邏輯樹狀結構中的根項目。

這個方法用於翻譯點擊測試點值。 如果您要撰寫控制項,而且需要在較低層級處理輸入,則呼叫此方法主要相關。 如果您使用現有的控制項,通常假設已完成的控制項會報告正確翻譯的點擊測試結果。

適用於