StrokeCollection.Erase 方法

定義

移除所指定區域之界限內的墨水。

多載

Erase(IEnumerable<Point>)

移除所指定區域之界限內的墨水。

Erase(Rect)

使用未輸入指定矩形界限的新筆劃,來取代由指定矩形所裁剪的所有筆劃。

Erase(IEnumerable<Point>, StylusShape)

將由指定之 StylusShape 所建立區域沿著指定路徑裁剪的所有筆劃,取代為該區域未裁剪的新筆劃。

Erase(IEnumerable<Point>)

移除所指定區域之界限內的墨水。

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))

參數

lassoPoints
IEnumerable<Point>

Point 型別的陣列,指定要清除的區域。

範例

下列範例示範如何在 中 StrokeCollection 清除筆劃。 此範例假設有 InkPresenter 名為 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

備註

方法會 Erase 連接 中的 lassoPoints 第一個和最後一個點,以建立套索。

StrokeCollection在呼叫 方法之後 Erase ,可能會包含新的筆劃。 例如,如果指定的區域是透過 的 Stroke 中間,清除方法會移除該方法, Stroke 並建立兩個新的筆劃。

方法 EraseStrokesChanged 針對其清除的每個 Stroke 引發 事件。

適用於

Erase(Rect)

使用未輸入指定矩形界限的新筆劃,來取代由指定矩形所裁剪的所有筆劃。

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)

參數

bounds
Rect

Rect,指定要清除的區域。

範例

下列範例示範如何清除 內的 Rect 筆跡。 此範例假設有 InkPresenter 名為 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)

備註

StrokeCollection在呼叫 方法之後 Erase ,可能會包含新的筆劃。 例如,如果指定的區域是透過 的 Stroke 中間,清除方法會移除該方法, Stroke 並建立兩個新的筆劃。 所有完全位於指定矩形內的筆劃都會移除。

方法 EraseStrokesChanged 針對其清除的每個 Stroke 引發 事件。

適用於

Erase(IEnumerable<Point>, StylusShape)

將由指定之 StylusShape 所建立區域沿著指定路徑裁剪的所有筆劃,取代為該區域未裁剪的新筆劃。

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)

參數

eraserPath
IEnumerable<Point>

Point 型別的陣列,指定要清除的路徑。

eraserShape
StylusShape

指定橡皮擦形狀的 StylusShape

範例

下列範例示範如何沿著特定路徑清除筆跡。 此範例假設有 InkPresenter 名為 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

備註

StrokeCollection在呼叫 方法之後 Erase ,可能會包含新的筆劃。 例如,如果 path 交集中間 Stroke ,清除方法會移除該方法, Stroke 並建立兩個新的筆劃。

方法 EraseStrokesChanged 針對其清除的每個 Stroke 引發 事件。

適用於