共用方式為


InkCollectorNewInAirPacketsEventArgs.PacketCount 屬性

取得收到的感應輸入「封包」數目。

命名空間:  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
收到的感應輸入封包數目。

備註

Cursor 物件進入「手寫板內容」的實體偵測範圍 (鄰近) 時,就會收到感應輸入封包。

範例

在這個範例中,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