private void OnStrokeErasing(InkCanvasStrokeErasingEventArgs e) { InkCanvasStrokeErasingEventHandler handler = StrokeErasing; if (handler != null) { handler(this, e); } }
private void EraseStroke(Contact contact) { Point position = contact.GetPosition(this); foreach (Stroke stroke in inkCanvas.Strokes.HitTest(new[] { position }, EraserShape)) { InkCanvasStrokeErasingEventArgs e = new InkCanvasStrokeErasingEventArgs(stroke); OnStrokeErasing(e); if (!e.Cancel) { inkCanvas.Strokes.Remove(stroke); RoutedEventArgs e2 = new RoutedEventArgs(StrokeErasedEvent, this); RaiseEvent(e2); } } }
private void ErasePoint(Contact contact) { Point position = contact.GetPosition(this); Point[] points = new[] { position }; foreach (Stroke stroke in inkCanvas.Strokes.HitTest(points, EraserShape)) { InkCanvasStrokeErasingEventArgs e = new InkCanvasStrokeErasingEventArgs(stroke); OnStrokeErasing(e); if (!e.Cancel) { StrokeCollection eraseResult = stroke.GetEraseResult(points, EraserShape); inkCanvas.Strokes.Replace(stroke, eraseResult); RoutedEventArgs e2 = new RoutedEventArgs(StrokeErasedEvent, this); RaiseEvent(e2); } } }
protected virtual void OnStrokeErasing(object sender, System.Windows.Controls.InkCanvasStrokeErasingEventArgs e) { InkCanvasStrokeErasingEventArgs e2 = new InkCanvasStrokeErasingEventArgs(e.Stroke); OnStrokeErasing(e2); }