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示します。 この例では、 と呼ばれる presenterがあることをInkPresenter前提としています。

// 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中央を通過している場合、erase メソッドはその領域 Stroke を削除し、2 つの新しいストロークを作成します。

メソッドは 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

次の例では、 内のインクを消去する方法を Rect示します。 この例では、 と呼ばれる presenterがあることをInkPresenter前提としています。

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中央を通過している場合、erase メソッドはその領域 Stroke を削除し、2 つの新しいストロークを作成します。 指定した四角形の内側にあるストロークはすべて削除されます。

メソッドは 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

次の例では、特定のパスに沿ってインクを消去する方法を示します。 この例では、 と呼ばれる presenterがあることをInkPresenter前提としています。

// 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 新しいストロークが含まれる場合があります。 たとえば、 のStroke真ん中と交差する場合path、erase メソッドによって削除され、2 つの新しいストロークがStroke作成されます。

メソッドは Erase 、消去する StrokesChanged ごとに Stroke イベントを発生させます。

適用対象