DynamicRenderer.Reset(StylusDevice, StylusPointCollection) Method

Definition

Clears rendering on the current stroke and redraws it.

C#
public virtual void Reset(System.Windows.Input.StylusDevice stylusDevice, System.Windows.Input.StylusPointCollection stylusPoints);

Parameters

stylusDevice
StylusDevice

The current stylus device.

stylusPoints
StylusPointCollection

The stylus points to be redrawn.

Exceptions

Neither the stylus nor the mouse is in the down state.

Examples

The following example changes the color of the current stroke as it is being drawn.

C#
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);
}

Remarks

The DynamicRenderer redraws the current stroke and any of the stylus points passed into the Reset method. This method allows you to redraw a stroke while the user is still creating the stroke. The tablet pen must be touching the digitizer or the left mouse button must be pressed when Reset is called.

Notes to Inheritors

When overriding Reset(StylusDevice, StylusPointCollection) in a derived class, be sure to call the base class' Reset(StylusDevice, StylusPointCollection) method.

Applies to

Ürün Sürümler
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10