Bagikan melalui


InkCollectorNewInAirPacketsEventArgs.PacketCount Property

Gets the number of in-air packet received.

Namespace:  Microsoft.Ink
Assembly:  Microsoft.Ink (in Microsoft.Ink.dll)

Syntax

'Declaration
Public ReadOnly Property PacketCount As Integer
'Usage
Dim instance As InkCollectorNewInAirPacketsEventArgs 
Dim value As Integer 

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

Property Value

Type: System.Int32
The number of in-air packets received.

Remarks

In-air packets are received when a Cursor object enters the physical detection range (proximity) of the tablet context.

Examples

In this example, an InkCollectorNewInAirPacketsEventHandler instance obtains the X and Y values of the last packet passed via the InkCollectorNewInAirPacketsEventArgs object. The X and Y values are always in the first two positions of the packet data.

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];

}

Platforms

Windows 7, Windows Vista, Windows Server 2008 R2, Windows Server 2008

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Version Information

.NET Framework

Supported in: 3.0

See Also

Reference

InkCollectorNewInAirPacketsEventArgs Class

InkCollectorNewInAirPacketsEventArgs Members

Microsoft.Ink Namespace

InkCollector.NewInAirPackets