DynamicRenderer.Reset(StylusDevice, StylusPointCollection) Método

Definição

Limpa a renderização no traço atual e volta a desenhá-la.

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 atual da stylus.

stylusPoints
StylusPointCollection

A caneta aponta para ser redesenhada.

Exceções

Nem a caneta nem o rato estão em estado baixo.

Exemplos

O exemplo seguinte altera a cor do traço atual à medida que está a ser 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

Observações

Redesenha DynamicRenderer o traço atual e qualquer um dos pontos do stylus passados para o Reset método. Este método permite redesenhar um traço enquanto o utilizador ainda está a criá-lo. A caneta do tablet deve estar a tocar no digitalizador ou o botão esquerdo do rato deve ser pressionado quando Reset é chamado.

Notas para Herdeiros

Ao substituir Reset(StylusDevice, StylusPointCollection) uma classe derivada, certifique-se de chamar o método da Reset(StylusDevice, StylusPointCollection) classe base.

Aplica-se a