Condividi tramite


Metodo IStylusSyncPlugin.Packets

Aggiornamento: novembre 2007

Informa l'oggetto che implementa l'interfaccia IStylusSyncPlugin che lo stilo si sposta sulla superficie del digitalizzatore.

Spazio dei nomi:  Microsoft.StylusInput
Assembly:  Microsoft.Ink (in Microsoft.Ink.dll)

Sintassi

'Dichiarazione
Sub Packets ( _
    sender As RealTimeStylus, _
    data As PacketsData _
)
'Utilizzo
Dim instance As IStylusSyncPlugin
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
)

Parametri

Note

È possibile modificare i dati dei pacchetti chiamando il metodo SetData ereditato dell'oggetto PacketsData contenuto nel parametro data.

Nota

Un'eccezione ArgumentException viene generata dal metodo SetData se la lunghezza della matrice nel parametro value non è un multiplo del valore della proprietà PacketPropertyCount ereditata.

È possibile annullare i pacchetti chiamando il metodo SetData con il parametro value impostato su null (Nothing in Microsoft Visual Basic .NET).

Esempi

Questo esempio C# è tratto da RealTimeStylus Plug-in Sample. Nell'esempio viene implementato un metodo Packets che disegna un piccolo cerchio nella posizione di ogni nuovo pacchetto ricevuto.

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);
  }
}

Questo esempio Microsoft Visual Basic .NET è tratto da RealTimeStylus Plug-in Sample. Nell'esempio viene implementato un metodo Packets che disegna un piccolo cerchio nella posizione di ogni nuovo pacchetto ricevuto.

Public Sub Packets(ByVal sender As RealTimeStylus, ByVal data As PacketsData) _
 Implements IStylusSyncPlugin.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

Piattaforme

Windows Vista, Windows XP SP2, Windows Server 2003

.NET Framework e .NET Compact Framework non supportano tutte le versioni di ciascuna piattaforma. Per un elenco delle versioni supportate, vedere Requisiti di sistema di .NET Framework.

Informazioni sulla versione

.NET Framework

Supportato in: 3.0

Vedere anche

Riferimenti

IStylusSyncPlugin Interfaccia

Membri IStylusSyncPlugin

Spazio dei nomi Microsoft.StylusInput

RealTimeStylus

Microsoft.StylusInput.PluginData.PacketsData