DynamicRenderer.Reset(StylusDevice, StylusPointCollection) Método

Definición

Borra la representación del trazo actual y la dibuja de nuevo.

public:
 virtual void Reset(System::Windows::Input::StylusDevice ^ stylusDevice, System::Windows::Input::StylusPointCollection ^ stylusPoints);
public virtual void Reset (System.Windows.Input.StylusDevice stylusDevice, System.Windows.Input.StylusPointCollection stylusPoints);
abstract member Reset : System.Windows.Input.StylusDevice * System.Windows.Input.StylusPointCollection -> unit
override this.Reset : System.Windows.Input.StylusDevice * System.Windows.Input.StylusPointCollection -> unit
Public Overridable Sub Reset (stylusDevice As StylusDevice, stylusPoints As StylusPointCollection)

Parámetros

stylusDevice
StylusDevice

Dispositivo de lápiz óptico actual.

stylusPoints
StylusPointCollection

Lápiz óptico que se va a dibujar de nuevo.

Excepciones

Ni el lápiz óptico ni el mouse están presionados.

Ejemplos

En el ejemplo siguiente se cambia el color del trazo actual a medida que se dibuja.

bool selectionMode = false;

public void ToggleSelect()
{
    StylusDevice currentStylus = Stylus.CurrentStylusDevice;

    // Check if the stylus is down or the mouse is pressed.
    if (Mouse.LeftButton != MouseButtonState.Pressed &&
        (currentStylus == null || currentStylus.InAir))
    {
        return;
    }
    
    selectionMode = !selectionMode;

    // If the control is in selection mode, change the color of 
    // the current stroke dark gray.
    if (selectionMode)
    {
        dynamicRenderer1.DrawingAttributes.Color = Colors.DarkGray;
    }
    else
    {
        dynamicRenderer1.DrawingAttributes.Color = Colors.Purple;
    }

    dynamicRenderer1.Reset(currentStylus, stylusPoints);
}
Private selectionMode As Boolean = False


Public Sub ToggleSelect() 
    Dim currentStylus As StylusDevice = Stylus.CurrentStylusDevice
    
    ' Check if the stylus is down or the mouse is pressed.
    If Mouse.LeftButton <> MouseButtonState.Pressed AndAlso _
      (currentStylus Is Nothing OrElse currentStylus.InAir) Then
        Return
    End If
    
    selectionMode = Not selectionMode
    
    ' If the control is in selection mode, change the color of 
    ' the current stroke dark gray.
    If selectionMode Then
        dynamicRenderer1.DrawingAttributes.Color = Colors.DarkGray
    
    Else
        dynamicRenderer1.DrawingAttributes.Color = Colors.Purple
    End If 
    
    dynamicRenderer1.Reset(currentStylus, stylusPoints)

End Sub

Comentarios

Vuelve DynamicRenderer a dibujar el trazo actual y cualquiera de los puntos del lápiz óptico pasados al Reset método . Este método permite volver a dibujar un trazo mientras el usuario sigue creando el trazo. El lápiz de tableta debe tocar el digitalizador o el botón izquierdo del mouse debe presionarse cuando Reset se llama a .

Notas a los desarrolladores de herederos

Al invalidar Reset(StylusDevice, StylusPointCollection) en una clase derivada, asegúrese de llamar al método de Reset(StylusDevice, StylusPointCollection) la clase base.

Se aplica a