共用方式為


StrokeCollection.Clone 方法

定義

複製 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

傳回

StrokeCollection 的複本。

範例

下列範例示範如何將一個中的筆跡複製到另一 InkCanvasInkCanvas 。 此範例假設:

  • 有兩 InkCanvasinkCanvas1 稱為 和 的物件 inkCanvas2.

  • 事件 Click 已連線到事件處理常式。

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

備註

方法 CloneStroke 複製集合中的每個專案,而新的 StrokeCollection 會參考新的筆劃。

適用於