共用方式為


StylusButtonCollection.GetStylusButtonByGuid(Guid) 方法

定義

取得指定之 GUID 所識別的 StylusButton

public:
 System::Windows::Input::StylusButton ^ GetStylusButtonByGuid(Guid guid);
public System.Windows.Input.StylusButton GetStylusButtonByGuid (Guid guid);
member this.GetStylusButtonByGuid : Guid -> System.Windows.Input.StylusButton
Public Function GetStylusButtonByGuid (guid As Guid) As StylusButton

參數

guid
Guid

指定所需之 GuidStylusButton

傳回

指定之 GUID 的 StylusButton

範例

下列範例示範如何取得 StylusButtonStatebarrel button

void textbox1_StylusInRange(object sender, StylusEventArgs e)
{
    StylusButtonCollection buttons = e.StylusDevice.StylusButtons;

    StylusButton barrelButton = buttons.GetStylusButtonByGuid(StylusPointProperties.BarrelButton.Id);
    if (barrelButton != null)
    {
        textbox1.AppendText(barrelButton.StylusButtonState.ToString());
    }

    textbox1.AppendText("\r\n");
}
Private Sub textbox1_StylusInRange(ByVal sender As Object, ByVal e As StylusEventArgs)

    Dim buttons As StylusButtonCollection = e.StylusDevice.StylusButtons

    Dim barrelButton As StylusButton = buttons.GetStylusButtonByGuid(StylusPointProperties.BarrelButton.Id)

    If Not barrelButton Is Nothing Then
        textbox1.AppendText(barrelButton.StylusButtonState.ToString())
    End If

    textbox1.AppendText(vbCr & vbLf)

End Sub

備註

類別 StylusPointProperties 包含 StylusPointProperty 平板電腦手寫筆上小費和滾筒按鈕的 。 Id使用 屬性來取得與按鈕相關聯的 GUID。

適用於