IStylusSyncPlugin.Packets-Methode
Informiert das die IStylusSyncPlugin-Schnittstelle implementierende Objekt darüber, dass sich der Tablettstift auf der Digitizeroberfläche bewegt.
Namespace: Microsoft.StylusInput
Assembly: Microsoft.Ink (in Microsoft.Ink.dll)
Syntax
'Declaration
Sub Packets ( _
sender As RealTimeStylus, _
data As PacketsData _
)
'Usage
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
)
Parameter
- sender
Typ: Microsoft.StylusInput.RealTimeStylus
Das RealTimeStylus-Objekt, das diese Methode aufgerufen hat.
- data
Typ: Microsoft.StylusInput.PluginData.PacketsData
Informationen über die Stiftbewegung.
Hinweise
Sie können die Paketdaten ändern, indem Sie die geerbte SetData-Methode des PacketsData-Objekts aufrufen, die im data-Parameter enthalten ist.
Hinweis
Eine ArgumentException-Ausnahme wird von der SetData-Methode ausgelöst, wenn die Länge des Arrays im value-Parameter kein Vielfaches des Werts der geerbten PacketPropertyCount-Eigenschaft ist.
Sie können die Pakete abbrechen, indem Sie die SetData-Methode aufrufen, deren value-Parameter auf NULL (Nothing in Microsoft Visual Basic .NET) festgelegt ist.
Beispiele
Dieses C#-Beispiel ist ein Auszug aus dem RealTimeStylus Plug-in Sample. In diesem Beispiel wird eine Packets-Methode implementiert, die einen kleinen Kreis am Speicherort jedes neu erhaltenen Pakets zeichnet.
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);
}
}
Dieses Visual Basic .NET-Beispiel ist ein Auszug aus dem RealTimeStylus Plug-in Sample. In diesem Beispiel wird eine Packets-Methode implementiert, die einen kleinen Kreis am Speicherort jedes neu erhaltenen Pakets zeichnet.
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
Plattformen
Windows Vista, Windows XP SP2, Windows Server 2003
.NET Framework und .NET Compact Framework unterstützen nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen für .NET Framework.
Versionsinformationen
.NET Framework
Unterstützt in: 3.0
Siehe auch
Referenz
IStylusSyncPlugin-Schnittstelle