InkCanvas.StrokeErasing Event


Occurs just before a user erases a stroke.

Namespace:   System.Windows.Controls
Assembly:  PresentationFramework (in PresentationFramework.dll)

Public Event StrokeErasing As InkCanvasStrokeErasingEventHandler

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.

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

Private Sub inkCanvas1_StrokeErasing(ByVal sender As Object, _
                             ByVal e As InkCanvasStrokeErasingEventArgs)

    If (e.Stroke.DrawingAttributes.IsHighlighter) Then
        e.Cancel = True

    End If
End Sub

.NET Framework
Available since 3.0
Return to top