StylusDevice.GetPosition(IInputElement) 方法

定義

取得手寫筆的位置。Gets the position of the stylus.

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

參數

relativeTo
IInputElement

(x,y) 座標所對應的 IInputElementThe IInputElement to which the (x,y) coordinates are mapped.

傳回

表示手寫筆位置的 Point,與 relativeTo 有關。A Point that represents the position of the stylus, in relation to relativeTo.

屬性

例外狀況

relativeTo 不是 UIElement,也不是 FrameworkContentElementrelativeTo is neither UIElement or FrameworkContentElement.

範例

下列範例示範GetPosition方法。The following example demonstrates the GetPosition method.

Point myPoint = myStylusDevice.GetPosition(myStylusDevice.Target);
textbox1.AppendText("The relative position is: (" + myPoint.X.ToString() + "," + myPoint.Y.ToString() + ")\n");
Dim myPoint As Point = myStylusDevice.GetPosition(myStylusDevice.Target)
textbox1.AppendText("The relative position is: (" + myPoint.X.ToString() + "," + myPoint.Y.ToString() + ")" + vbCrLf)

適用於