語言

StrokeCollection.Erase 方法

定義

去除指定區域範圍內的墨水。

多載

名稱 Description
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 並產生兩筆新筆劃。

Erase該方法會為StrokesChanged每消除一個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 A,指定要抹除的區域。

範例

以下範例示範如何在 中擦除墨水 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 並產生兩筆新筆劃。 所有完全位於指定矩形內的筆劃都會被移除。

Erase該方法會為StrokesChanged每消除一個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 A則指定橡皮擦的形狀。

範例

以下範例示範如何沿著特定路徑擦拭墨水。 此範例假設存在一個 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 ,並產生兩個新的筆劃。

Erase該方法會為StrokesChanged每消除一個Stroke事件而提高。

適用於