Partager via


IStylusAsyncPlugin.StylusUp, méthode

Mise à jour : November 2007

Avertit le plug-in d'implémentation que le stylet n'est plus en contact avec la surface du digitaliseur du Tablet PC.

Espace de noms :  Microsoft.StylusInput
Assembly :  Microsoft.Ink (dans Microsoft.Ink.dll)

Syntaxe

'Déclaration
Sub StylusUp ( _
    sender As RealTimeStylus, _
    data As StylusUpData _
)
'Utilisation
Dim instance As IStylusAsyncPlugin
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
)

Paramètres

Notes

Vous pouvez modifier les données de paquet en appelant la méthode SetData héritée de l'objet StylusUpData contenu dans le paramètre data.

ms585064.alert_note(fr-fr,VS.90).gifRemarque :

Une exception ArgumentException (page pouvant être en anglais) est levée par la méthode SetData si la longueur du tableau dans le paramètre valeur n'est pas égale à la valeur de la propriété PacketPropertyCount héritée.

Exemples

Cet exemple C# est extrait du RealTimeStylus Plug-in Sample. L'exemple montre comment limiter la saisie du stylet à un rectangle donné.

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

Cet exemple Microsoft Visual Basic .NET est extrait du RealTimeStylus Plug-in Sample. L'exemple montre comment limiter la saisie du stylet à un rectangle donné.

Public Sub StylusUp(ByVal sender As RealTimeStylus, ByVal data As StylusUpData) _
 Implements IStylusAsyncPlugin.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

Plateformes

Windows Vista, Windows XP SP2, Windows Server 2003

Le .NET Framework et le .NET Compact Framework ne prennent pas en charge toutes les versions de chaque plateforme. Pour obtenir la liste des versions prises en charge, consultez Configuration requise du .NET Framework.

Informations de version

.NET Framework

Pris en charge dans : 3.0

Voir aussi

Référence

IStylusAsyncPlugin, interface

Membres IStylusAsyncPlugin

Microsoft.StylusInput, espace de noms

StylusUpData