ערוך

שתף באמצעות


StrokeCollection.Erase Method

Definition

Removes the ink that is within the bounds of the specified area.

Overloads

Erase(IEnumerable<Point>)

Removes the ink that is within the bounds of the specified area.

Erase(Rect)

Replaces all strokes that are clipped by the specified rectangle with new strokes that do not enter the bounds of the specified rectangle.

Erase(IEnumerable<Point>, StylusShape)

Replaces all strokes that are clipped by the region created by the specified StylusShape along the specified path with new Strokes that are not clipped by the region.

Erase(IEnumerable<Point>)

Removes the ink that is within the bounds of the specified area.

public:
 void Erase(System::Collections::Generic::IEnumerable<System::Windows::Point> ^ lassoPoints);
public void Erase (System.Collections.Generic.IEnumerable<System.Windows.Point> lassoPoints);
member this.Erase : seq<System.Windows.Point> -> unit
Public Sub Erase (lassoPoints As IEnumerable(Of Point))

Parameters

lassoPoints
IEnumerable<Point>

An array of type Point that specifies the area to be erased.

Examples

The following example demonstrates how to erase strokes in a StrokeCollection. This example assumes that there is an InkPresenter called presenter.

// Erase the selected strokes.
public void EraseStrokes(Stroke lasso)
{
    Point[] strokePoints = (Point[])lasso.StylusPoints;
    presenter.Strokes.Erase(strokePoints);
}
' Erase the selected strokes.
Public Overloads Sub EraseStrokes(ByVal lasso As Stroke)

    If lasso Is Nothing Then
        Return
    End If

    Dim strokePoints() As Point = CType(lasso.StylusPoints, Point())

    presenter.Strokes.Erase(strokePoints)

End Sub

Remarks

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

The StrokeCollection might contain new strokes after the Erase method is called. For example, if the specified area is through the middle of a Stroke, the erase method removes that Stroke and creates two new strokes.

The Erase method raises the StrokesChanged event for each Stroke it erases.

Applies to

Erase(Rect)

Replaces all strokes that are clipped by the specified rectangle with new strokes that do not enter the bounds of the specified rectangle.

public:
 void Erase(System::Windows::Rect bounds);
public void Erase (System.Windows.Rect bounds);
member this.Erase : System.Windows.Rect -> unit
Public Sub Erase (bounds As Rect)

Parameters

bounds
Rect

A Rect that specifies the area to be erased.

Examples

The following example demonstrates how to erase the ink within the Rect. This example assumes that there is an InkPresenter called presenter.

Rect rect = new Rect(100, 100, 200, 200);
presenter.Strokes.Erase(rect);
Dim rect As Rect = New Rect(100, 100, 200, 200)
presenter.Strokes.Erase(rect)

Remarks

The StrokeCollection might contain new strokes after the Erase method is called. For example, if the specified area is through the middle of a Stroke, the erase method removes that Stroke and creates two new strokes. All strokes that are entirely inside the specified rectangle are removed.

The Erase method raises the StrokesChanged event for each Stroke it erases.

Applies to

Erase(IEnumerable<Point>, StylusShape)

Replaces all strokes that are clipped by the region created by the specified StylusShape along the specified path with new Strokes that are not clipped by the region.

public:
 void Erase(System::Collections::Generic::IEnumerable<System::Windows::Point> ^ eraserPath, System::Windows::Ink::StylusShape ^ eraserShape);
public void Erase (System.Collections.Generic.IEnumerable<System.Windows.Point> eraserPath, System.Windows.Ink.StylusShape eraserShape);
member this.Erase : seq<System.Windows.Point> * System.Windows.Ink.StylusShape -> unit
Public Sub Erase (eraserPath As IEnumerable(Of Point), eraserShape As StylusShape)

Parameters

eraserPath
IEnumerable<Point>

An array of type Point that specifies the path to be erased.

eraserShape
StylusShape

A StylusShape that specifies the shape of the eraser.

Examples

The following example demonstrates how to erase ink along a specific path. This example assumes that there is an InkPresenter called presenter.

// Erase the ink that intersects the lasso.
public void ErasePath(Stroke lasso)
{
    EllipseStylusShape eraserTip = new EllipseStylusShape(5, 5);
    Point[] strokePoints = (Point[])lasso.StylusPoints;

    presenter.Strokes.Erase(strokePoints, eraserTip);
}
' Erase the ink that intersects the lasso.
Public Overloads Sub ErasePath(ByVal lasso As Stroke)

    If lasso Is Nothing Then
        Return
    End If

    Dim eraserTip As New EllipseStylusShape(5, 5, 0)
    Dim strokePoints() As Point = CType(lasso.StylusPoints, Point())

    presenter.Strokes.Erase(strokePoints, eraserTip)

End Sub

Remarks

The StrokeCollection might contain new strokes after the Erase method is called. For example, if path intersects the middle of a Stroke, the erase method removes that Stroke and creates two new strokes.

The Erase method raises the StrokesChanged event for each Stroke it erases.

Applies to