Bagikan melalui


StrokeCollection.Clone Metode

Definisi

StrokeCollectionMenyalin .

public:
 virtual System::Windows::Ink::StrokeCollection ^ Clone();
public virtual System.Windows.Ink.StrokeCollection Clone ();
abstract member Clone : unit -> System.Windows.Ink.StrokeCollection
override this.Clone : unit -> System.Windows.Ink.StrokeCollection
Public Overridable Function Clone () As StrokeCollection

Mengembalikan

Salinan .StrokeCollection

Contoh

Contoh berikut menunjukkan cara menyalin tinta satu InkCanvas ke yang lain InkCanvas. Contoh ini mengasumsikan:

  • Ada dua InkCanvas objek yang disebut inkCanvas1 dan inkCanvas2.

  • Kejadian Click telah tersambung ke penanganan aktivitas.

// Copy the strokes from one InkCanvas to another InkCanvas.
private void CopyStrokes_Click(object sender, RoutedEventArgs e) 
{
    StrokeCollection strokes = inkCanvas1.Strokes.Clone();
    inkCanvas2.Strokes.Clear();
    inkCanvas2.Strokes.Add(strokes);
}
' Copy the strokes from one InkCanvas to another InkCanvas.
Private Sub CopyStrokes_Click(ByVal sender As Object, ByVal e As RoutedEventArgs)

    Dim strokes As StrokeCollection = inkCanvas1.Strokes.Clone()
    inkCanvas2.Strokes.Clear()
    inkCanvas2.Strokes.Add(strokes)

End Sub

Keterangan

Metode Clone menyalin masing-masing Stroke dalam koleksi dan yang baru StrokeCollection mereferensikan goresan baru.

Berlaku untuk