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


IStylusAsyncPlugin.Packets - метод

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

Notifies the object implementing the IStylusAsyncPlugin interface that the stylus is moving on the digitizer.

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

Синтаксис

'Декларация
Sub Packets ( _
    sender As RealTimeStylus, _
    data As PacketsData _
)
'Применение
Dim instance As IStylusAsyncPlugin
Dim sender As RealTimeStylus
Dim data As PacketsData

instance.Packets(sender, data)
void Packets(
    RealTimeStylus sender,
    PacketsData data
)
void Packets(
    RealTimeStylus^ sender, 
    PacketsData^ data
)
void Packets(
    RealTimeStylus sender,
    PacketsData data
)
function Packets(
    sender : RealTimeStylus, 
    data : PacketsData
)

Параметры

Заметки

You can modify the packet data by calling the inherited SetData method of the PacketsData object contained in the data parameter.

ms585056.alert_note(ru-ru,VS.90).gifПримечание.

An ArgumentException exception is thrown by the SetData method if the length of the array in the value parameter is not a multiple of the value of the inherited PacketPropertyCount property.

You can cancel the packets by calling the SetData method with the value parameter set to nullссылка null (Nothing в Visual Basic) (Nothing in Microsoft Visual Basic .NET).

Примеры

This C# example is excerpted from the RealTimeStylus Plug-in Sample. It implements a Packets method that draws a small circle in the location of each new packet received.

public void Packets(RealTimeStylus sender,  PacketsData data)
{           
  // For each new packet received, extract the x,y data
  // and draw a small circle around the result.
  for (int i = 0; i < data.Count ; i += data.PacketPropertyCount)
  {
    // Packet data always has x followed by y followed by the rest
    Point point = new Point(data[i], data[i+1]);

    // Since the packet data is in Ink Space coordinates, we need to convert to Pixels...
    point.X = (int)Math.Round((float)point.X * (float)myGraphics.DpiX/2540.0F);
    point.Y = (int)Math.Round((float)point.Y * (float)myGraphics.DpiY/2540.0F);

    // Draw a circle corresponding to the packet
    myGraphics.DrawEllipse(Pens.Green, point.X - 2, point.Y - 2, 4, 4);
  }
}

This Visual Basic .NET example is excerpted from the RealTimeStylus Plug-in Sample. It implements a Packets method that draws a small circle in the location of each new packet received.

Public Sub Packets(ByVal sender As RealTimeStylus, ByVal data As PacketsData) _
 Implements IStylusAsyncPlugin.Packets
    ' For each new packet received, extract the x,y data
    ' and draw a small circle around the result.
    Dim i As Integer
    For i = 0 To data.Count - data.PacketPropertyCount Step data.PacketPropertyCount
        ' Packet data always has x followed by y followed by the rest
        Dim point As New Point(data(i), data((i + 1)))

        ' Since the packet data is in Ink Space coordinates,
        ' we need to convert to Pixels...
        point.X = Math.Round((System.Convert.ToSingle(point.X) * _
              System.Convert.ToSingle(myGraphics.DpiX) / 2540.0F))
        point.Y = Math.Round((System.Convert.ToSingle(point.Y) * _
              System.Convert.ToSingle(myGraphics.DpiY) / 2540.0F))

        ' Draw a circle corresponding to the packet
        myGraphics.DrawEllipse(Pens.Green, point.X - 2, point.Y - 2, 4, 4)
    Next i
End Sub 'Packets

Платформы

Windows Vista, Windows XP с пакетом обновления 2 (SP2), Windows Server 2003

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

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

.NET Framework

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

См. также

Ссылки

IStylusAsyncPlugin Интерфейс

IStylusAsyncPlugin - члены

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

RealTimeStylus

Microsoft.StylusInput.PluginData.PacketsData