Stylus.Captured 属性

定义

获取绑定了触笔的元素。

public:
 static property System::Windows::IInputElement ^ Captured { System::Windows::IInputElement ^ get(); };
public static System.Windows.IInputElement Captured { get; }
static member Captured : System.Windows.IInputElement
Public Shared ReadOnly Property Captured As IInputElement

属性值

绑定了触笔的 IInputElement

示例

以下示例演示如何确保在用户将触笔触摸到数字化器时不会捕获触笔。 此示例假定 PreviewStylusDown 事件已连接到事件处理程序。

void Window1_PreviewStylusDown(object sender, StylusEventArgs e)
{
    IInputElement capturedElement = Stylus.Captured;

    if (capturedElement != null)
    {
        capturedElement.ReleaseStylusCapture();
    }
}
Private Sub Window1_PreviewStylusDown(ByVal sender As Object, ByVal e As StylusDownEventArgs) _
    Handles Me.PreviewStylusDown

    Dim capturedElement As IInputElement = Stylus.Captured

    If Not (capturedElement Is Nothing) Then
        capturedElement.ReleaseStylusCapture()
    End If

End Sub

适用于