Stroke.GetPacketValuesByProperty 方法 (Guid)

返回 Stroke 对象中所有数据包的指定数据包 属性的数据。

命名空间:  Microsoft.Ink
程序集:  Microsoft.Ink(在 Microsoft.Ink.dll 中)

语法

声明
Public Function GetPacketValuesByProperty ( _
    id As Guid _
) As Integer()
用法
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 int[] GetPacketValuesByProperty(
    Guid id
)
public function GetPacketValuesByProperty(
    id : Guid
) : int[]

参数

返回值

类型:array<System.Int32[]
返回一个有符号 32 位整数数组,该数组指定对 Stroke 对象中的每个请求点所请求的 PacketProperty 对象的值。

备注

特定的 Stroke 对象可能未提供特定的数据包属性。一台 Tablet PC 可能有多个 Tablet 可供用户输入。Tablets 集合包含附加到 Tablet PC 的所有 Tablet 的列表。使用 IsPacketPropertySupported 方法可确定特定的 Tablet 对象或所有可用 Tablet 是否支持特定的数据包属性。此外,使用 InkCollector.DesiredPacketDescriptionInkOverlay.DesiredPacketDescriptionInkPicture.DesiredPacketDescription 属性还可以控制收集新笔画的哪些数据包属性。

示例

在此示例中,修改 InkOverlay 对象的所有选定 Stroke 对象,以便 NormalPressure 数据包在该笔画的所有点中始终增加或保持不变。

使用 GetPacketValuesByProperty 方法获取 Stroke 对象的 NormalPressure 数据包值并按升序对其排序。然后,使用 SetPacketValuesByProperty 方法将排序后的值重新应用于该笔画。

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
}

平台

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