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。 此示例假定:

  • 有两 InkCanvas 个对象称为 inkCanvas1inkCanvas2.

  • 事件 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

注解

方法 Clone 复制 Stroke 集合中的每个笔划,新 StrokeCollection 引用新笔划。

适用于