DynamicRenderer.Reset(StylusDevice, StylusPointCollection) Método

Definição

Limpa a renderização do traço atual e o redesenha.

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

O dispositivo de caneta atual.

stylusPoints
StylusPointCollection

Os pontos de caneta a serem redesenhados.

Exceções

Nem a caneta nem o mouse estão inoperantes.

Exemplos

O exemplo a seguir altera a cor do traço atual conforme ele está sendo desenhado.

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

Comentários

O DynamicRenderer redesenha o traço atual e qualquer um dos pontos de caneta passados para o Reset método . Esse método permite que você redesenhe um traço enquanto o usuário ainda está criando o traço. A caneta do tablet deve estar tocando no digitalizador ou o botão esquerdo do mouse deve ser pressionado quando Reset é chamado.

Notas aos Herdeiros

Ao substituir Reset(StylusDevice, StylusPointCollection) em uma classe derivada, chame o método da Reset(StylusDevice, StylusPointCollection) classe base.

Aplica-se a