Stroke.Clone Method ()


Returns a deep copy of the existing Stroke object.

Namespace:   System.Windows.Ink
Assembly:  PresentationCore (in PresentationCore.dll)

public virtual Stroke Clone()

Return Value

Type: System.Windows.Ink.Stroke

The new Stroke object.

The properties of an object that is a deep copy of another object have the same values as the properties of the original object.

The following example demonstrates how to get a copy of the current Stroke object.

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

.NET Framework
Available since 3.0
Return to top