Stylus.CurrentStylusDevice Property


Gets the stylus that represents the stylus currently in use.

 static property System::Windows::Input::StylusDevice ^ CurrentStylusDevice { System::Windows::Input::StylusDevice ^ get(); };
[get: System.Security.SecurityCritical]
public static System.Windows.Input.StylusDevice CurrentStylusDevice { get; }
member this.CurrentStylusDevice : System.Windows.Input.StylusDevice
Public Shared ReadOnly Property CurrentStylusDevice As StylusDevice

Property Value

The StylusDevice that represents the stylus currently in use.



The following example demonstrates how to erase the text that is selected with an inverted stylus. This example assumes that there is a TextBox called textBox1 and that the StylusUpEvent event is connected to the event handler.

void TextBoxStylusUp(object sender, StylusEventArgs e)
    StylusDevice currentStylus = Stylus.CurrentStylusDevice;

    if (currentStylus.Inverted)
        string selectedText = textbox1.SelectedText;
        textbox1.SelectedText = "";
Private Sub TextBoxStylusUp(ByVal sender As Object, ByVal e As StylusEventArgs) _
    Handles textbox1.StylusUp

    Dim currentStylus As StylusDevice = Stylus.CurrentStylusDevice

    If currentStylus.Inverted Then
        Dim selectedText As String = textbox1.SelectedText
        textbox1.SelectedText = ""
    End If

End Sub

Applies to