Compartir a través de


IStylusAsyncPlugin.StylusUp (Método)

Actualización: noviembre 2007

Notifica al complemento de implementación que el usuario ha elevado el lápiz fuera de la superficie del digitalizador de Tablet PC.

Espacio de nombres:  Microsoft.StylusInput
Ensamblado:  Microsoft.Ink (en Microsoft.Ink.dll)

Sintaxis

'Declaración
Sub StylusUp ( _
    sender As RealTimeStylus, _
    data As StylusUpData _
)
'Uso
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
)

Parámetros

Comentarios

Puede modificar los datos de la entrada mediante una llamada al método SetData heredado del objeto StylusUpData que está contenido en el parámetro data.

Nota

El método SetData inicia la excepción ArgumentException si la longitud de la matriz del parámetro value no es igual al valor de la propiedad PacketPropertyCount heredada.

Ejemplos

Este ejemplo de C# se ha extraído de RealTimeStylus Plug-in Sample. En el ejemplo se muestra cómo limitar la entrada manuscrita a un rectángulo especificado.

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

Este ejemplo de Microsoft Visual Basic .NET se ha extraído de RealTimeStylus Plug-in Sample. En el ejemplo, se muestra cómo limitar la entrada manuscrita a un rectángulo especificado.

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

Plataformas

Windows Vista, Windows XP SP2, Windows Server 2003

.NET Framework y .NET Compact Framework no admiten todas las versiones de cada plataforma. Para obtener una lista de las versiones compatibles, vea Requisitos de sistema de .NET Framework.

Información de versión

.NET Framework

Compatible con: 3.0

Vea también

Referencia

IStylusAsyncPlugin (Interfaz)

IStylusAsyncPlugin (Miembros)

Microsoft.StylusInput (Espacio de nombres)

StylusUpData