Stylus.CurrentStylusDevice 属性

定义

获取当前正在使用的触笔。

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

属性值

StylusDevice,表示当前正在使用的触笔。

属性

示例

以下示例演示如何擦除使用倒转触笔选择的文本。 此示例假定有 一个 TextBox 被调用 textBox1 的 ,并且该 StylusUpEvent 事件已连接到事件处理程序。

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

适用于