InkCanvas.StrokeErasing 事件

定义

恰好在用户擦除笔画之前发生。

public:
 event System::Windows::Controls::InkCanvasStrokeErasingEventHandler ^ StrokeErasing;
public event System.Windows.Controls.InkCanvasStrokeErasingEventHandler StrokeErasing;
member this.StrokeErasing : System.Windows.Controls.InkCanvasStrokeErasingEventHandler 
Public Custom Event StrokeErasing As InkCanvasStrokeErasingEventHandler 
Public Event StrokeErasing As InkCanvasStrokeErasingEventHandler 

事件类型

InkCanvasStrokeErasingEventHandler

示例

以下示例阻止任何呈现为荧光笔的笔划被擦除。 该示例假定已 InkCanvas 连接到事件处理程序。

void inkCanvas1_StrokeErasing(object sender, InkCanvasStrokeErasingEventArgs e)
{
    if (e.Stroke.DrawingAttributes.IsHighlighter)
    {
        e.Cancel = true;
    }
}
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

注解

如果要检查是否应擦除笔划,请处理此事件。 Set the Cancel property to true if you want to prevent the stroke from being erased. 当或属性设置为或设置时EraseByPoint,可以使用此方法EditingModeEditingModeInverted EraseByStroke

适用于