InkCollectorNewInAirPacketsEventArgs.PacketCount 属性

获取所接收的 in-air packet 的数目。

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

语法

声明
Public ReadOnly Property PacketCount As Integer
用法
Dim instance As InkCollectorNewInAirPacketsEventArgs
Dim value As Integer

value = instance.PacketCount
public int PacketCount { get; }
public:
property int PacketCount {
    int get ();
}
/** @property */
public int get_PacketCount()
public function get PacketCount () : int

属性值

类型:System.Int32
所接收的 in-air packet 的数目。

备注

Cursor 对象进入 Tablet 上下文 的物理检测范围(接近)时所接收的 in-air packet。

示例

在此示例中,InkCollectorNewInAirPacketsEventHandler 实例获得通过 InkCollectorNewInAirPacketsEventArgs 对象传递的最后一个数据包的 XY 值。XY 值总是位于数据包数据的前两个位置。

Private Sub mInkObject_NewInAirPackets2(ByVal sender As Object, ByVal e As InkCollectorNewInAirPacketsEventArgs)
    Dim DescriptorsPerPacket As Integer = 0
    ' determine how many descriptors there are per packet
    ' you could also obtain this value using:
    '   e.PacketData.Length / e.PacketCount
    ' but if you need to know which particular properties
    ' are supported (beyond X and Y which are always placed first)
    ' you will need to query e.Cursor.Tablet.IsPacketPropertySupported()
    For Each G As Guid In mInkObject.DesiredPacketDescription
        If (e.Cursor.Tablet.IsPacketPropertySupported(G)) Then
            DescriptorsPerPacket += 1
        End If
    Next

    Dim LastX As Integer = e.PacketData(DescriptorsPerPacket * (e.PacketCount - 1))
    Dim LastY As Integer = e.PacketData((DescriptorsPerPacket * (e.PacketCount - 1)) + 1)
End Sub
private void mInkObject_NewInAirPackets2(object sender, InkCollectorNewInAirPacketsEventArgs e)
{
    int DescriptorsPerPacket = 0;
    // determine how many descriptors there are per packet
    // you could also obtain this value using:
    //   e.PacketData.Length / e.PacketCount
    // but if you need to know which particular properties
    // are supported (beyond X and Y which are always placed first)
    // you will need to query e.Cursor.Tablet.IsPacketPropertySupported()

    foreach (Guid G in mInkObject.DesiredPacketDescription)
    {
        if (e.Cursor.Tablet.IsPacketPropertySupported(G))
        {
            DescriptorsPerPacket++;
        }
    }

    int LastX = e.PacketData[DescriptorsPerPacket * (e.PacketCount - 1)];
    int LastY = e.PacketData[(DescriptorsPerPacket * (e.PacketCount - 1)) + 1];

}

平台

Windows Vista

.NET Framework 和 .NET Compact Framework 并不是对每个平台的所有版本都提供支持。有关支持的版本的列表,请参见.NET Framework 系统要求

版本信息

.NET Framework

受以下版本支持:3.0

另请参见

参考

InkCollectorNewInAirPacketsEventArgs 类

InkCollectorNewInAirPacketsEventArgs 成员

Microsoft.Ink 命名空间

InkCollector.NewInAirPackets