MouseDevice.GetPosition(IInputElement) 方法

定義

取得相對於指定項目的滑鼠位置。

public:
 System::Windows::Point GetPosition(System::Windows::IInputElement ^ relativeTo);
[System.Security.SecurityCritical]
public System.Windows.Point GetPosition (System.Windows.IInputElement relativeTo);
public System.Windows.Point GetPosition (System.Windows.IInputElement relativeTo);
[<System.Security.SecurityCritical>]
member this.GetPosition : System.Windows.IInputElement -> System.Windows.Point
member this.GetPosition : System.Windows.IInputElement -> System.Windows.Point
Public Function GetPosition (relativeTo As IInputElement) As Point

參數

relativeTo
IInputElement

要在其中計算滑鼠位置的參考框架。

傳回

相對於參數 relativeTo 的滑鼠位置。

屬性

例外狀況

relativeTonull,或不是 UIElementContentElement

備註

滑鼠指標的位置是相對於指定的 IInputElement ,其中元素左上角是原點 0,0。

適用於