次の方法で共有


Stroke.SetPacketValuesByProperty Method

Stroke.SetPacketValuesByProperty Method

Sets the packet values for a particular PacketProperty object within this Stroke object.

Definition

Visual Basic .NET Public Function SetPacketValuesByProperty( _
ByVal id As Guid, _
ByVal packetValues() As Integer _
) As Integer
C# public int SetPacketValuesByProperty(
Guid id,
int[] packetValues
);
Managed C++ public: int* SetPacketValuesByProperty(
Guid *id,
int *packetValues __gc[]
);

Parameters

id System.Guid. The Guid Leave Site identifier from the PacketProperty object that is used to select which packet data is set. Use the PacketDescription property to determine the defined properties for this Stroke object.
packetValues System.Int32[]. The array of packet data values. The method fails if any of the values in the array exceed the minimum or maximum value of the property. To determine the range of values in the property, call the GetPacketDescriptionPropertyMetrics method.

Return Value

System.Int32. Returns the actual number of packets set.

Remarks

All packets are modified.

Examples

[C#]

This C# example sets the PacketProperty.NormalPressure property to a constant value for every packet in the Stroke object, theStroke.

Note: If theStroke was created by a mouse rather than a pen, then SetPacketValuesByProperty throws an ArgumentException Leave Site exception, because pressure can not be set with a mouse.

int[] theNewValues = new int[theStroke.PacketCount];
for (int i = 0; i < theStroke.PacketCount; i++)
    theNewValues[i] = 6;
theStroke.SetPacketValuesByProperty(
    PacketProperty.NormalPressure, theNewValues);
                

[VB.NET]

This Microsoft® Visual Basic® .NET example sets the PacketProperty.NormalPressure property to a constant value for every packet in the Stroke object, theStroke.

Note: If theStroke was created by a mouse rather than a pen, then SetPacketValuesByProperty throws an ArgumentException Leave Site exception, because pressure can not be set with a mouse.

Dim theNewValues(theStroke.PacketCount - 1) As Integer
Dim index As Integer
For index = 0 To theStroke.PacketCount - 1
    theNewValues(index) = 6
Next
theStroke.SetPacketValuesByProperty( _
    PacketProperty.NormalPressure, theNewValues)
                

See Also