Sdílet prostřednictvím


Stylus.Buttons Property

Gets the StylusButtons object available on the Stylus object.

Namespace:  Microsoft.StylusInput
Assembly:  Microsoft.Ink (in Microsoft.Ink.dll)

Syntax

'Declaration
Public ReadOnly Property Buttons As StylusButtons
'Usage
Dim instance As Stylus 
Dim value As StylusButtons 

value = instance.Buttons
public StylusButtons Buttons { get; }
public:
property StylusButtons^ Buttons {
    StylusButtons^ get ();
}
public function get Buttons () : StylusButtons

Property Value

Type: Microsoft.StylusInput.StylusButtons
The StylusButtons obect available on the Stylus object.

Remarks

The buttons described in the StylusButtons object may include the pen tip, the eraser end, and the barrel button.

Examples

This Microsoft Visual C# .NET example is a snippet from a form's helper method, StylusDataToString. The helper method takes a Stylus object and returns a string containing information about the Stylus object and its buttons.

using Microsoft.Ink;
using Microsoft.StylusInput;
using Microsoft.StylusInput.PluginData;

// ...

// Declare the RealTimeStylus objects, the GestureRecognizer plugin,
// and the DynamicRenderer plug-in.
private Microsoft.StylusInput.RealTimeStylus thePrimaryRealTimeStylus = null;
private Microsoft.StylusInput.RealTimeStylus theSecondaryRealTimeStylus = null;
private Microsoft.StylusInput.GestureRecognizer theGestureRecognizer = null;
private Microsoft.StylusInput.DynamicRenderer theDynamicRenderer = null;

// ...

// Returns information about a given stylus.
private string StylusDataToString(Stylus theStylus)
{
    System.Text.StringBuilder result = new System.Text.StringBuilder();

    // Add information about the tablet pen.
    result.Append(
        string.Format("  Name = {0}, Id = {1}, ContextId = {2}, Inverted = {3}, Button Count = {4}."
        + Environment.NewLine, theStylus.Name, theStylus.Id,
        theStylus.TabletContextId, theStylus.Inverted, theStylus.Buttons.Count));

    // Add information about each of the tabet pen's buttons.
    for (int i=0; i<theStylus.Buttons.Count; i++)
    {
        result.Append(
            string.Format("    Button {0}: Name = {1}, Id = {2}" + Environment.NewLine,
            i, theStylus.Buttons.GetName(i), theStylus.Buttons.GetId(i)));
    }

    return result.ToString();
}

Platforms

Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Version Information

.NET Framework

Supported in: 3.0

See Also

Reference

Stylus Class

Stylus Members

Microsoft.StylusInput Namespace

StylusButtons

Microsoft.StylusInput.PluginData.StylusButtonDataBase

Microsoft.StylusInput.PluginData.StylusButtonDownData

Microsoft.StylusInput.PluginData.StylusButtonUpData