Metodo IStylusSyncPlugin.StylusUp
Aggiornamento: novembre 2007
Notifica al plug-in di implementazione quando l'utente solleva lo stilo dalla superficie del digitalizzatore.
Spazio dei nomi: Microsoft.StylusInput
Assembly: Microsoft.Ink (in Microsoft.Ink.dll)
Sintassi
'Dichiarazione
Sub StylusUp ( _
sender As RealTimeStylus, _
data As StylusUpData _
)
'Utilizzo
Dim instance As IStylusSyncPlugin
Dim sender As RealTimeStylus
Dim data As StylusUpData
instance.StylusUp(sender, data)
void StylusUp(
RealTimeStylus sender,
StylusUpData data
)
void StylusUp(
RealTimeStylus^ sender,
StylusUpData^ data
)
void StylusUp(
RealTimeStylus sender,
StylusUpData data
)
function StylusUp(
sender : RealTimeStylus,
data : StylusUpData
)
Parametri
- sender
Tipo: Microsoft.StylusInput.RealTimeStylus
Oggetto RealTimeStylus che ha inviato la notifica.
- data
Tipo: Microsoft.StylusInput.PluginData.StylusUpData
Informazioni sull'oggetto Stylus associato alla notifica.
Note
È possibile modificare i dati dei pacchetti chiamando il metodo SetData ereditato dell'oggetto StylusUpData contenuto nel parametro data.
Nota
Un'eccezione ArgumentException viene generata dal metodo SetData se la lunghezza della matrice nel parametro value non è uguale al valore della proprietà PacketPropertyCount ereditata.
Esempi
Questo esempio C# è tratto da RealTimeStylus Plug-in Sample. Nell'esempio viene illustrato come limitare l'input penna a un rettangolo specificato.
public void StylusUp(RealTimeStylus sender, StylusUpData data)
{
ModifyPacketData(data);
}
private void ModifyPacketData(StylusDataBase data)
{
// For each packet in the packet data, check whether
// its x,y values fall outside of the specified rectangle.
// If so, replace them with the nearest point that still
// falls within the rectangle.
for (int i = 0; i < data.Count ; i += data.PacketPropertyCount)
{
// packet data always has x followed by y followed by the rest
int x = data[i];
int y = data[i+1];
// Constrain points to the input rectangle
x = Math.Max(x, rectangle.Left);
x = Math.Min(x, rectangle.Right);
y = Math.Max(y, rectangle.Top);
y = Math.Min(y, rectangle.Bottom);
// If necessary, modify the x,y packet data
if (x != data[i])
{
data[i] = x;
}
if (y != data[i+1])
{
data[i+1] = y;
}
}
}
Questo esempio Microsoft Visual Basic .NET è tratto da RealTimeStylus Plug-in Sample. Nell'esempio viene illustrato come limitare l'input penna a un rettangolo specificato.
Public Sub StylusUp(ByVal sender As RealTimeStylus, ByVal data As StylusUpData) _
Implements IStylusSyncPlugin.StylusUp
ModifyPacketData(data)
End Sub 'StylusUp
Private Sub ModifyPacketData(ByVal data As StylusDataBase)
' For each packet in the packet data, check whether
' its x,y values fall outside of the specified rectangle.
' If so, replace them with the nearest point that still
' falls within the rectangle.
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 x As Integer = data(i)
Dim y As Integer = data((i + 1))
' Constrain points to the input rectangle
x = Math.Max(x, rectangle.Left)
x = Math.Min(x, rectangle.Right)
y = Math.Max(y, rectangle.Top)
y = Math.Min(y, rectangle.Bottom)
' If necessary, modify the x,y packet data
If x <> data(i) Then
data(i) = x
End If
If y <> data((i + 1)) Then
data((i + 1)) = y
End If
Next i
End Sub 'ModifyPacketData
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