Bagikan melalui


StrokeCollection.Replace Metode

Definisi

Menggantikan goresan dalam koleksi.

Overload

Replace(Stroke, StrokeCollection)

Mengganti yang ditentukan Stroke dengan yang ditentukan StrokeCollection.

Replace(StrokeCollection, StrokeCollection)

Mengganti yang ditentukan StrokeCollection dengan yang baru StrokeCollection.

Replace(Stroke, StrokeCollection)

Mengganti yang ditentukan Stroke dengan yang ditentukan StrokeCollection.

public:
 void Replace(System::Windows::Ink::Stroke ^ strokeToReplace, System::Windows::Ink::StrokeCollection ^ strokesToReplaceWith);
public void Replace (System.Windows.Ink.Stroke strokeToReplace, System.Windows.Ink.StrokeCollection strokesToReplaceWith);
member this.Replace : System.Windows.Ink.Stroke * System.Windows.Ink.StrokeCollection -> unit
Public Sub Replace (strokeToReplace As Stroke, strokesToReplaceWith As StrokeCollection)

Parameter

strokeToReplace
Stroke

untuk Stroke menggantikan.

strokesToReplaceWith
StrokeCollection

Sumber StrokeCollection.

Pengecualian

strokesToReplace kosong.

-atau-

strokesToReplaceWith kosong.

-atau-

In StrokestrokesToReplaceWith sudah ada di strokesToReplace.

Contoh

Contoh berikut menunjukkan cara mengganti goresan yang dipilih pada InkCanvas dengan yang lain StrokeCollection. Contoh ini mengasumsikan bahwa ada yang InkCanvas disebut inkCanvas1.

// Replace the selected strokes with other strokes.
private void ReplaceStrokes(StrokeCollection strokes)
{
    StrokeCollection selectedStrokes = inkCanvas1.GetSelectedStrokes();

    if (selectedStrokes != null && selectedStrokes.Count > 0)
    {
        inkCanvas1.Strokes.Replace(selectedStrokes, strokes);
    }
}
' Replace the selected strokes with other strokes.
Private Sub ReplaceStrokes(ByVal strokes As StrokeCollection)

    Dim selectedStrokes As StrokeCollection = inkCanvas1.GetSelectedStrokes()

    If Not (selectedStrokes Is Nothing) Then
        inkCanvas1.Strokes.Replace(selectedStrokes, strokes)
    End If

End Sub

Keterangan

Metode Replace ini meningkatkan StrokesChanged peristiwa.

Berlaku untuk

Replace(StrokeCollection, StrokeCollection)

Mengganti yang ditentukan StrokeCollection dengan yang baru StrokeCollection.

public:
 void Replace(System::Windows::Ink::StrokeCollection ^ strokesToReplace, System::Windows::Ink::StrokeCollection ^ strokesToReplaceWith);
public void Replace (System.Windows.Ink.StrokeCollection strokesToReplace, System.Windows.Ink.StrokeCollection strokesToReplaceWith);
member this.Replace : System.Windows.Ink.StrokeCollection * System.Windows.Ink.StrokeCollection -> unit
Public Sub Replace (strokesToReplace As StrokeCollection, strokesToReplaceWith As StrokeCollection)

Parameter

strokesToReplace
StrokeCollection

Tujuan StrokeCollection.

strokesToReplaceWith
StrokeCollection

Sumber StrokeCollection.

Pengecualian

strokesToReplace kosong.

-atau-

strokesToReplaceWith kosong.

-atau-

In StrokestrokesToReplaceWith sudah ada di strokesToReplace.

-atau-

Goresan di strokesToReplaceWith tidak terus menerus.

Contoh

Contoh berikut menunjukkan cara mengganti goresan yang dipilih pada InkCanvas dengan yang lain StrokeCollection. Contoh ini mengasumsikan bahwa ada yang InkCanvas disebut inkCanvas1.

// Replace the selected strokes with other strokes.
private void ReplaceStrokes(StrokeCollection strokes)
{
    StrokeCollection selectedStrokes = inkCanvas1.GetSelectedStrokes();

    if (selectedStrokes != null && selectedStrokes.Count > 0)
    {
        inkCanvas1.Strokes.Replace(selectedStrokes, strokes);
    }
}
' Replace the selected strokes with other strokes.
Private Sub ReplaceStrokes(ByVal strokes As StrokeCollection)

    Dim selectedStrokes As StrokeCollection = inkCanvas1.GetSelectedStrokes()

    If Not (selectedStrokes Is Nothing) Then
        inkCanvas1.Strokes.Replace(selectedStrokes, strokes)
    End If

End Sub

Keterangan

Metode Replace ini menaikkan StrokesChanged peristiwa untuk setiap Stroke penggantiannya.

Berlaku untuk