InkCanvas.StrokeErasing Event

Definition

Important

Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

Occurs just before a user erases a stroke.

C#
public event System.Windows.Controls.InkCanvasStrokeErasingEventHandler StrokeErasing;

Event Type

Examples

The following example prevents any strokes rendered as highlighters from being erased. The example assumes that the InkCanvas is connected to the event handler.

C#
void inkCanvas1_StrokeErasing(object sender, InkCanvasStrokeErasingEventArgs e)
{
    if (e.Stroke.DrawingAttributes.IsHighlighter)
    {
        e.Cancel = true;
    }
}

Remarks

Handle this event when you want to check whether a stroke should be erased. Set the Cancel property to true if you want to prevent the stroke from being erased. You can use this technique when the EditingMode or EditingModeInverted property is set to EraseByStroke or EraseByPoint.

Applies to

Produkt Versioner
.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