Freigeben über


IStylusSyncPlugin.StylusUp-Methode

Benachrichtigt das implementierende Plug-In, wenn der Benutzer den Tablettstift von der Oberfläche des Digitizers abhebt.

Namespace:  Microsoft.StylusInput
Assembly:  Microsoft.Ink (in Microsoft.Ink.dll)

Syntax

'Declaration
Sub StylusUp ( _
    sender As RealTimeStylus, _
    data As StylusUpData _
)
'Usage
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
)

Parameter

Hinweise

Sie können die Paketdaten ändern, indem Sie die geerbte SetData-Methode des StylusUpData-Objekts aufrufen, das 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 nicht gleich dem Wert der geerbten PacketPropertyCount-Eigenschaft ist.

Beispiele

Dieses C#-Beispiel ist ein Auszug aus dem RealTimeStylus Plug-in Sample. Im Beispiel wird veranschaulicht, wie Stifteingaben auf ein angegebenes Rechteck eingeschränkt werden.

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

Dieses Microsoft Visual Basic .NET-Beispiel ist ein Auszug aus dem RealTimeStylus Plug-in Sample. Im Beispiel wird veranschaulicht, wie Stifteingaben auf ein angegebenes Rechteck eingeschränkt werden.

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

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

IStylusSyncPlugin-Member

Microsoft.StylusInput-Namespace

StylusUpData