Stroke.Clone 方法

定义

返回现有 Stroke 对象的深层副本。

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

返回

Stroke

新的 Stroke 对象。

示例

以下示例演示如何获取当前 Stroke 对象的副本。



Stroke GetLittleRedStroke(Stroke theStroke)
{
    // Copy the incoming stroke
    Stroke sCopy = theStroke.Clone();

    // Scale it by 50%
    Matrix xform = new Matrix();
    xform.Scale(0.5, 0.5);

    sCopy.Transform(xform, false);

    // Color it red
    sCopy.DrawingAttributes.Color = Colors.Red;

    // Return the new stroke
    return (sCopy);
}

Function GetLittleRedStroke(ByVal theStroke As Stroke) As Stroke
    ' Copy the incoming stroke
    Dim sCopy As Stroke = theStroke.Clone()

    ' Scale it by 50%
    Dim xform As New Matrix()
    xform.Scale(0.5, 0.5)

    sCopy.Transform(xform, False)

    ' Color it red
    sCopy.DrawingAttributes.Color = Colors.Red

    ' Return the new stroke
    Return sCopy

End Function 'getLittleRedStroke

注解

作为另一个对象的深层副本的对象的属性与原始对象的属性具有相同的值。

适用于