Język

DynamicRenderer.Reset(StylusDevice, StylusPointCollection) Metoda

Definicja

Czyści renderowanie bieżącego pociągnięcia i ponownie je rysuje.

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)

Parametry

stylusDevice
StylusDevice

Bieżące urządzenie rysików.

stylusPoints
StylusPointCollection

Rysik wskazuje na ponowne rysowanie.

Wyjątki

Ani rysik, ani mysz nie są w stanie w dół.

Przykłady

Poniższy przykład zmienia kolor bieżącego pociągnięcia podczas rysowania.

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

Uwagi

Narysuje DynamicRenderer bieżący pociągnięcie i dowolny z punktów rysika przekazanych Reset do metody . Ta metoda umożliwia ponowne rysowanie pociągnięcia, gdy użytkownik nadal tworzy pociągnięcie. Pióro tabletu musi dotykać cyfry lub lewego przycisku myszy należy nacisnąć po Reset wywołaniu.

Notatki dotyczące dziedziczenia

Podczas zastępowania Reset(StylusDevice, StylusPointCollection) klasy pochodnej należy wywołać metodę klasy Reset(StylusDevice, StylusPointCollection) bazowej.

Dotyczy