Stroke.GetEraseResult Method

Definition

Returns the segments of the current Stroke after part of the Stroke is erased.

Overloads

GetEraseResult(IEnumerable<Point>)

Returns segments of the current Stroke that are outside the specified bounds.

GetEraseResult(Rect)

Returns segments of the current Stroke that are outside the specified rectangle.

GetEraseResult(IEnumerable<Point>, StylusShape)

Returns the segments of the current Stroke after it is dissected by the designated path using the specified StylusShape.

GetEraseResult(IEnumerable<Point>)

Returns segments of the current Stroke that are outside the specified bounds.

C#
public System.Windows.Ink.StrokeCollection GetEraseResult(System.Collections.Generic.IEnumerable<System.Windows.Point> lassoPoints);

Parameters

lassoPoints
IEnumerable<Point>

An array of type Point that specifies the area to erase.

Returns

A StrokeCollection that contains the segments of the current Stroke that are outside the specified bounds.

Examples

The following example removes the ink that is within the specified bounds.

C#
Point[] myPoints = new Point[] {
    new Point(100, 100),
    new Point(200, 100),
    new Point(200, 200),
    new Point(100, 200)};

StrokeCollection eraseResults = aStroke.GetEraseResult(myPoints);

// inkCanvas1 is the InkCanvas on which we update the strokes
inkCanvas1.Strokes.Remove(aStroke);
inkCanvas1.Strokes.Add(eraseResults);

Remarks

The GetEraseResult method returns a StrokeCollection that contains strokes that represent the segments of the Stroke that are outside of lassoPoints. GetEraseResult does not change the original Stroke.

The GetClipResult method connects the first and last points in lassoPoints to create the lasso.

Applies to

.NET Framework 4.8.1 and other versions
Product Versions
.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

GetEraseResult(Rect)

Returns segments of the current Stroke that are outside the specified rectangle.

C#
public System.Windows.Ink.StrokeCollection GetEraseResult(System.Windows.Rect bounds);

Parameters

bounds
Rect

A Rect that specifies the area to erase.

Returns

A StrokeCollection that contains the segments of the current Stroke that are outside the bounds of the specified Rect.

Examples

The following example removes the ink that is within the specified bounds.

C#
Rect myRect = new Rect(100, 100, 100, 100);

StrokeCollection eraseResults = aStroke.GetEraseResult(myRect);

// inkCanvas1 is the InkCanvas on which we update the strokes
inkCanvas1.Strokes.Remove(aStroke);
inkCanvas1.Strokes.Add(eraseResults);

Remarks

The GetEraseResult method returns a StrokeCollection that contains strokes that represent the segments of the Stroke that are outside of bounds. GetEraseResult does not change the original Stroke.

Applies to

.NET Framework 4.8.1 and other versions
Product Versions
.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

GetEraseResult(IEnumerable<Point>, StylusShape)

Returns the segments of the current Stroke after it is dissected by the designated path using the specified StylusShape.

C#
public System.Windows.Ink.StrokeCollection GetEraseResult(System.Collections.Generic.IEnumerable<System.Windows.Point> eraserPath, System.Windows.Ink.StylusShape eraserShape);

Parameters

eraserPath
IEnumerable<Point>

An array of type Point that specifies the path that dissects the Stroke.

eraserShape
StylusShape

A StylusShape that specifies the shape of the eraser.

Returns

A StrokeCollection that contains copies of the segments of the current Stroke after it is dissected by the specified path.

Examples

The following example demonstrates how to erase the ink that intersects a specified path.

C#
Point[] myPoints = new Point[] {
    new Point(100, 100),
    new	Point(200, 100),
    new	Point(200, 200),
    new	Point(100, 200)};

EllipseStylusShape myStylus = new EllipseStylusShape(5.0, 5.0, 0.0);

StrokeCollection eraseResults = aStroke.GetEraseResult(myPoints, myStylus);

// inkCanvas1 is the InkCanvas on which we update the strokes
inkCanvas1.Strokes.Remove(aStroke);
inkCanvas1.Strokes.Add(eraseResults);

Remarks

The GetEraseResult method uses eraserShape to hit test the stroke along eraserPath and returns a StrokeCollection that represent dissected segments. GetEraseResult does not change the original Stroke.

Applies to

.NET Framework 4.8.1 and other versions
Product Versions
.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