Språk

Stroke.Clone Metod

Definition

Returnerar en djup kopia av det befintliga Stroke objektet.

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

Returer

Det nya Stroke objektet.

Exempel

I följande exempel visas hur du hämtar en kopia av det aktuella Stroke objektet.



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

Kommentarer

Egenskaperna för ett objekt som är en djup kopia av ett annat objekt har samma värden som egenskaperna för det ursprungliga objektet.

Gäller för