Share via


Stroke.GetPacketValuesByProperty Method (Guid)

Returns the data for a specified packet property for all of the packets in the Stroke object.

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

Syntax

'Declaration
Public Function GetPacketValuesByProperty ( _
    id As Guid _
) As Integer()
'Usage
Dim instance As Stroke 
Dim id As Guid 
Dim returnValue As Integer()

returnValue = instance.GetPacketValuesByProperty(id)
public int[] GetPacketValuesByProperty(
    Guid id
)
public:
array<int>^ GetPacketValuesByProperty(
    Guid id
)
public function GetPacketValuesByProperty(
    id : Guid
) : int[]

Parameters

Return Value

Type: array<System.Int32[]
Returns an array of signed 32-bit integers that specifies the value of the requested PacketProperty object for each point requested from the Stroke object.

Remarks

A specific packet property may not be available on a particular Stroke object. A Tablet PC may have more than one tablet for user input. The Tablets collection contains a list of all the tablets attached to the Tablet PC. Use the IsPacketPropertySupported method to determine if a particular packet property is supported by a specific Tablet object or by all the available tablets. Also, use the InkCollector.DesiredPacketDescription, InkOverlay.DesiredPacketDescription, or InkPicture.DesiredPacketDescription properties to control which packet properties are collected on new strokes.

Examples

In this example, each selected Stroke object of an InkOverlay object is modified so that the NormalPressure packet always increases or remains constant throughout the points of the stroke.

Using the GetPacketValuesByProperty method, the NormalPressure packet values for the Stroke object are obtained and sorted into ascending order. The sorted values are then reapplied to the stroke using the SetPacketValuesByProperty method.

Try 
    For Each S As Stroke In mInkOverlay.Selection
        ' get the NormalPressure values 
        Dim npValues() As Integer = S.GetPacketValuesByProperty(PacketProperty.NormalPressure)
        ' sort them
        Array.Sort(npValues)
        ' set the NormalPressure values
        S.SetPacketValuesByProperty(PacketProperty.NormalPressure, npValues)
    Next 
Catch ex As ArgumentException
    ' This exception will be raised if PacketProperty.NormalPressure is not supported 
    ' This will be the case if creating strokes with a mouse 
End Try
try
{
    foreach (Stroke S in mInkOverlay.Selection)
    {
        // get the NormalPressure values 
        int[] npValues = S.GetPacketValuesByProperty(PacketProperty.NormalPressure);
        // sort them
        Array.Sort(npValues);
        // set the NormalPressure values
        S.SetPacketValuesByProperty(PacketProperty.NormalPressure, npValues);
    }
}
catch (ArgumentException)
{
    // This exception will be raised if PacketProperty.NormalPressure is not supported 
    // This will be the case if creating strokes with a mouse
}

Platforms

Windows 7, Windows Vista, Windows Server 2008 R2, Windows Server 2008

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

Stroke Class

Stroke Members

GetPacketValuesByProperty Overload

Microsoft.Ink Namespace

InkCollector.DesiredPacketDescription

InkOverlay.DesiredPacketDescription

InkPicture.DesiredPacketDescription

PacketProperty

Tablet

Tablet.IsPacketPropertySupported

Tablets

Tablets.IsPacketPropertySupported