共用方式為


RealTimeStylus.GetDesiredPacketDescription Method

RealTimeStylus.GetDesiredPacketDescription Method

Gets the RealTimeStylus object's interest in aspects of the packets collected on a tablet context.

Definition

Visual Basic .NET Public Function GetDesiredPacketDescription() As Guid()
C# public Guid[] GetDesiredPacketDescription();
Managed C++ public: Guid* GetDesiredPacketDescription() __gc[];

Return Value

System.Guid[]. Returns the globally unique identifiers (GUIDs) for the packet properties in which the RealTimeStylus object is interested.

Exceptions

ObjectDisposedException Leave Site: The RealTimeStylus object is disposed.

Remarks

Use this method to get the set of packet properties in which the RealTimeStylus object has interest. The packet properties are represented by an array of globally unique identifiers (GUIDs). The PacketProperty object defines standard packet property GUIDs; however, other GUIDs may also be used.

When the RealTimeStylus object is collecting ink from a tablet, the RealTimeStylus object only returns packet data for the packet properties that you have set interest in, as represented by the return value of the GetDesiredPacketDescription method, and that are supported by the tablet on which the ink is being collected. For more information about how ink data is handled by the RealTimeStylus object, see Ink-Collector Plug-ins.

Calls to the SetDesiredPacketDescription method do not affect incoming packet data until the Enabled property changes from false to true. However, calls to the SetDesiredPacketDescription method immediately affect what is returned by calls to the GetDesiredPacketDescription method.

The following list describes how the RealTimeStylus object orders the packet property GUIDs.

For example, if you call the SetDesiredPacketDescription method with (a, b, a, PacketStatus, b, c, d), a call to the GetDesiredPacketDescription method returns (X, Y, a, b, c, d, PacketStatus).

Examples

This Microsoft® Visual C#® .NET example is a snippet from a menu item's Click Leave Site event handler. The menu is part of a form on which a TextBox Leave Site object, theTextBox, is defined. If the RealTimeStylus object is disabled, the event handler exits. Otherwise, the event handler calls the RealTimeStylus object's GetDesiredPacketDescription method.

[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;

// ...

// The GetDesiredPacketDescription menu item's ClickEventHandler
private void theMenuItemGetDesiredPacketDescription_Click(object sender,
    System.EventArgs e)
{
    // Can not call this method while the RealTimeStylus is disabled.
    if (!this.thePrimaryRealTimeStylus.Enabled)
    {
        MessageBox.Show("The GetDesiredPacketDescription method of the RealTimeStylus can only be called while the RealTimeStylus is enabled.");
        return;
    }

    this.theTextBox.Text = "DesiredPacketDescription = " + Environment.NewLine;
    foreach (Guid theGuid in this.thePrimaryRealTimeStylus.GetDesiredPacketDescription())
    {
        this.theTextBox.Text += string.Format("  {0}" + Environment.NewLine,
            this.GetPacketPropertyNameFromGuid(theGuid));
    }
}

See Also