Поделиться через


Stroke.GetPacketValuesByProperty - метод (Guid, Int32, Int32)

Обновлен: Ноябрь 2007

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

Пространство имен:  Microsoft.Ink
Сборка:  Microsoft.Ink (в Microsoft.Ink.dll)

Синтаксис

'Декларация
Public Function GetPacketValuesByProperty ( _
    id As Guid, _
    index As Integer, _
    count As Integer _
) As Integer()
'Применение
Dim instance As Stroke
Dim id As Guid
Dim index As Integer
Dim count As Integer
Dim returnValue As Integer()

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

Параметры

  • index
    Тип: System.Int32
    The starting point of the zero-based index to a packet within the Stroke object.
  • count
    Тип: System.Int32
    The number of points that make up the stroke data.

Возвращаемое значение

Тип: 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.

Заметки

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.

Примеры

In this example, each selected Stroke object of an InkOverlay object is modified so that each point of the first half of the stroke contains the minimum allowed NormalPressure packet value.

Using the GetPacketValuesByProperty method, the NormalPressure packet values for the first half of the Stroke object are obtained. The values are then set to the minimum allowed (as obtained via the GetPacketDescriptionPropertyMetrics method), and reapplied to the stroke using the SetPacketValuesByProperty method.

Try
    For Each S As Stroke In mInkOverlay.Selection
        ' get the PacketProperty.NormalPressure metrics for the stroke
        Dim metrics As TabletPropertyMetrics = S.GetPacketDescriptionPropertyMetrics(PacketProperty.NormalPressure)
        ' we want to get half of the NormalPressure values
        Dim halfWayPt As Integer = S.PacketCount / 2
        ' get the NormalPressure values for the first half of the packets
        Dim npValues() As Integer = S.GetPacketValuesByProperty(PacketProperty.NormalPressure, 0, halfWayPt)
        ' set the NormalPressure values to min
        For k As Integer = 0 To npValues.Length - 1
            npValues(k) = metrics.Minimum
        Next
        ' set the NormalPressure values for the first half of the packets
        S.SetPacketValuesByProperty(PacketProperty.NormalPressure, 0, halfWayPt, 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 PacketProperty.NormalPressure metrics for the stroke
        TabletPropertyMetrics metrics = S.GetPacketDescriptionPropertyMetrics(PacketProperty.NormalPressure);
        // we want to get half of the NormalPressure values
        int halfWayPt = S.PacketCount / 2;
        // get the NormalPressure values for the first half of the packets
        int[] npValues = S.GetPacketValuesByProperty(PacketProperty.NormalPressure, 0, halfWayPt);
        // set the NormalPressure values to min
        for (int k = 0; k < npValues.Length; k++)
        {
            npValues[k] = metrics.Minimum;
        }
        // set the NormalPressure values for the first half of the packets
        S.SetPacketValuesByProperty(PacketProperty.NormalPressure, 0, halfWayPt, 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
}

Платформы

Windows Vista

Среды .NET Framework и .NET Compact Framework поддерживают не все версии каждой платформы. Поддерживаемые версии перечислены в разделе Требования к системе для .NET Framework.

Сведения о версии

.NET Framework

Поддерживается в версии: 3.0

См. также

Ссылки

Stroke Класс

Stroke - члены

GetPacketValuesByProperty - перегрузка

Microsoft.Ink - пространство имен

InkCollector.DesiredPacketDescription

InkOverlay.DesiredPacketDescription

InkPicture.DesiredPacketDescription

PacketProperty

Tablet

Tablet.IsPacketPropertySupported

Tablets

Tablets.IsPacketPropertySupported