Condividi tramite


RealTimeStylus.GetTabletFromTabletContextID Method

RealTimeStylus.GetTabletFromTabletContextID Method

Gets the Tablet object that is associated with a given tablet context identifier.

Definition

Visual Basic .NET Public Function GetTabletFromTabletContextID( _
ByVal tabletContextId As Integer _
) As Tablet
C# public Tablet GetTabletFromTabletContextID(
int tabletContextId
);
Managed C++ public: Tablet* GetTabletFromTabletContextID(
int *tabletContextId
);

Parameters

tabletContextId System.Int32. The tablet context identifier for which you want the associated Tablet object.

Return Value

Microsoft.Ink.Tablet. The Tablet object that is associated with a given tablet context identifier.

Exceptions

COMException Leave Site:
InvalidOperationException Leave Site: OutOfOrder Call
ObjectDisposedException Leave Site: The object is already disposed.

Remarks

Note: A tablet context identifier is specific to RealTimeStylus object. Two RealTimeStylus objects may have a different context identifiers for the same tablet.

Examples

This Microsoft® Visual C#® .NET example is a snippet from the implementation of the IStylusAsyncPlugin interface's RealTimeStylusEnabled method. The form which implements the IStylusAsyncPlugin interface contains a TextBox Leave Site object, theTextBox. The RealTimeStylusEnabled method displays information about the tablets that are available at the time the RealTimeStylus object is enabled.

[C#]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;

// ...

// Called when the RealTimeStylus is enabled, or when the plug-in is added to
// a RealTimeStylus that is already enabled.
public void RealTimeStylusEnabled(RealTimeStylus sender,
    RealTimeStylusEnabledData data)
{
    // Display the list of available tablets.
    this.theTextBox.Text = string.Format(
        "RealTimeStylus enabled ({0} tablets attached):" + Environment.NewLine,
        data.Count);
    foreach (int theContextId in data)
    {
        Tablet theTablet =
            this.thePrimaryRealTimeStylus.GetTabletFromTabletContextId(theContextId);

        this.theTextBox.Text += string.Format(
            "  ContextId = {0}, Tablet.Name = {1}" + Environment.NewLine,
            theContextId, theTablet.Name);

        this.theTextBox.Text += "   Available packet properties:" + Environment.NewLine;

        foreach(TabletPropertyDescription theTabletPropertyDescription in
            this.thePrimaryRealTimeStylus.GetTabletPropertyDescriptionCollection(theContextId))
        {
            this.theTextBox.Text += string.Format("    {0}" + Environment.NewLine,
                this.GetPacketPropertyNameFromGuid(theTabletPropertyDescription.PacketPropertyId));
        }
    }
}

See Also