StrokeCollection.Clone Método

Definição

Copia o StrokeCollection.

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

Retornos

Uma cópia do StrokeCollection.

Exemplos

O exemplo a seguir demonstra como copiar a tinta em um InkCanvas para outro InkCanvas. Este exemplo pressupõe que:

  • Há dois InkCanvas objetos chamados inkCanvas1 e inkCanvas2.

  • O Click evento foi conectado ao manipulador de eventos.

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

Comentários

O Clone método copia cada Stroke um na coleção e o novo StrokeCollection faz referência aos novos traços.

Aplica-se a