Share via


Ink.ExtractStrokes Method (Strokes, ExtractFlags)

Extracts the specified Stroke objects from the Ink object by using either cut or copy, as specified, and returns a new Ink object containing the extracted Stroke objects.

Namespace:  Microsoft.Ink
Assembly:  Microsoft.Ink (in Microsoft.Ink.dll)

Syntax

'Declaration
Public Function ExtractStrokes ( _
    strokes As Strokes, _
    extractionFlags As ExtractFlags _
) As Ink
'Usage
Dim instance As Ink 
Dim strokes As Strokes 
Dim extractionFlags As ExtractFlags 
Dim returnValue As Ink 

returnValue = instance.ExtractStrokes(strokes, _
    extractionFlags)
public Ink ExtractStrokes(
    Strokes strokes,
    ExtractFlags extractionFlags
)
public:
Ink^ ExtractStrokes(
    Strokes^ strokes, 
    ExtractFlags extractionFlags
)
public function ExtractStrokes(
    strokes : Strokes, 
    extractionFlags : ExtractFlags
) : Ink

Parameters

Return Value

Type: Microsoft.Ink.Ink
Returns an Ink object that contains the extracted Strokes collection.

Remarks

The new Ink object retains the drawing attributes, properties, and coordinates of the original Ink object.

The default behavior for this method is to remove the Strokes collection from the original Ink object. To preserve the Strokes collection in the original Ink object and make a copy of the Ink, call either the ExtractStrokes or ExtractStrokes overload of this method with the extractionFlags parameter set to the CopyFromOriginal value from the ExtractFlags enumeration.

Examples

In this example, a new Ink object is created that contains the first two Stroke objects of an InkOverlay object. The Strokes collection is preserved in the original Ink object, because the extractionFlags parameter is set to the CopyFromOriginal value from the ExtractFlags enumeration.

' Access to the Strokes property returns a copy of the Strokes object. 
' This copy must be implicitly (via using statement) or explicitly 
' disposed of in order to asub a memory leak. 
Using allStrokes As Strokes = mInkOverlay.Ink.Strokes
    If (allStrokes.Count > 2) Then 
        Dim temp As Strokes = allStrokes.Ink.CreateStrokes()
        temp.Add(allStrokes(0))
        temp.Add(allStrokes(1))
        Dim newInk As Ink = allStrokes.Ink.ExtractStrokes(temp, ExtractFlags.CopyFromOriginal)
    End If 
End Using
// Access to the Strokes property returns a copy of the Strokes object. 
// This copy must be implicitly (via using statement) or explicitly 
// disposed of in order to avoid a memory leak. 
using (Strokes allStrokes = mInkOverlay.Ink.Strokes)
{
    if (allStrokes.Count > 2)
    {
        Strokes temp = allStrokes.Ink.CreateStrokes();
        temp.Add(allStrokes[0]);
        temp.Add(allStrokes[1]);
        Ink newInk = allStrokes.Ink.ExtractStrokes(temp, ExtractFlags.CopyFromOriginal);
    }
}

Platforms

Windows 7, Windows Vista, Windows Server 2008 R2, Windows Server 2008

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.

Version Information

.NET Framework

Supported in: 3.0

See Also

Reference

Ink Class

Ink Members

ExtractStrokes Overload

Microsoft.Ink Namespace

Strokes

ExtractFlags