StylusButtonCollection.GetStylusButtonByGuid Method (Guid)

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Gets the StylusButton that the specified GUID identifies.

Namespace:   System.Windows.Input
Assembly:  PresentationCore (in PresentationCore.dll)

public StylusButton GetStylusButtonByGuid(
	Guid guid
)

Parameters

guid
Type: System.Guid

The Guid that specifies the desired StylusButton.

Return Value

Type: System.Windows.Input.StylusButton

The StylusButton of the specified GUID.

The StylusPointProperties class contains a StylusPointProperty for the tip and barrel buttons on a tablet pen. Use the Id property to get the GUID associated with a button.

The following example demonstrates how to get the StylusButtonState of the barrel 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");

}

.NET Framework
Available since 3.0
Return to top
Show: