Udostępnij przez


DynamicRenderer.Reset(StylusDevice, StylusPointCollection) Metoda

Definicja

Czyści renderowanie na bieżącym pociągnięciu 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

W poniższym przykładzie kolor bieżącego pociągnięcia zmienia się w miarę rygowania.

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 do Reset metody . Ta metoda umożliwia ponowne rysowanie pociągnięcia, gdy użytkownik nadal tworzy pociągnięcie. Pióro tabletu musi dotykać cyfryzatora lub po wywołaniu przycisku myszy po wywołaniu Reset należy nacisnąć lewy przycisk myszy.

Uwagi dotyczące dziedziczenia

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

Dotyczy