DynamicRenderer.Reset(StylusDevice, StylusPointCollection) Metod

Definition

Rensar återgivningen på den aktuella linjen och ritar om den.

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)

Parametrar

stylusDevice
StylusDevice

Den aktuella pennanheten.

stylusPoints
StylusPointCollection

Pennan pekar på att ritas om.

Undantag

Varken pennan eller musen är i nedläge.

Exempel

I följande exempel ändras färgen på den aktuella linjen när den ritas.

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

Kommentarer

Den DynamicRenderer ritar om den aktuella linjen och någon av pennans punkter skickas till Reset metoden. Med den här metoden kan du rita om en linje medan användaren fortfarande skapar strecket. Tablet-pennan måste röra digitaliseraren eller så måste den vänstra musknappen tryckas in när Reset den anropas.

Anteckningar till arvingar

När du åsidosättar Reset(StylusDevice, StylusPointCollection) i en härledd klass måste du anropa basklassens Reset(StylusDevice, StylusPointCollection) metod.

Gäller för