Edit

Share via


Stylus.CurrentStylusDevice Property

Definition

Gets the stylus that represents the stylus currently in use.

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

Property Value

The StylusDevice that represents the stylus currently in use.

Attributes

Examples

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