Export (0) Print
Expand All

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()
You cannot use methods in XAML.

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

Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0

Community Additions

ADD
Show:
© 2014 Microsoft