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

備註

一個物件作為另一個物件的深度複製,其屬性與原始物件的屬性值相同。

適用於