Share via


Ink.ExtractStrokes Method

Ink.ExtractStrokes Method

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.

Definition

Visual Basic .NET Public Function ExtractStrokes( _
ByVal strokes As Strokes, _
ByVal extractionFlags As ExtractFlags _
) As Ink
C# public Ink ExtractStrokes(
Strokes strokes,
ExtractFlags extractionFlags
);
Managed C++ public: Ink* ExtractStrokes(
Strokes *strokes,
ExtractFlags *extractionFlags
);

Parameters

> > >
strokes Microsoft.Ink.Strokes. The Strokes collection to extract.
extractionFlags Microsoft.Ink.ExtractFlags. One of the ExtractFlags values that specifies whether the ink is cut or copied into the new Ink object.

CopyFromOriginal0 Copies ink from the Ink object.
RemoveFromOriginal1 Cuts ink from the Ink object.
Default1 Cuts ink from the Ink object.

Return Value

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

Exceptions

ArgumentException Leave Site: An invalid Stroke object was passed to this method. Verify that the Stroke object corresponds to this Ink object.
COMException Leave Site:
ObjectDisposedException Leave Site: The Stroke object is disposed.

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(Strokes,ExtractFlags) or ExtractStrokes(Rectangle,ExtractFlags) overload of this method with the extractionFlags parameter set to CopyFromOriginal.

To extract a Strokes collection that is bound by a rectangle, call the ExtractStrokes(Rectangle) or ExtractStrokes(Rectangle,ExtractFlags) method.

Examples

[C#]

This C# example creates a new Ink object, theNewInk. The new Ink object contains a previously determined set of strokes, theStrokes, which are copied from the Ink object in an InkCollector, theInkCollector. The Strokes collection remains in the original Ink object, because the extractionFlags parameter is set to CopyFromOriginal.

Ink theNewInk = theInkCollector.Ink.ExtractStrokes(theDeletedStrokes,
    ExtractFlags.CopyFromOriginal);

[Visual Basic .NET]

This Microsoft® Visual Basic® .NET example creates a new Ink object, theNewInk. The new Ink object contains a previously determined set of strokes, theStrokes, which are copied from the Ink object in an InkCollector, theInkCollector. The Strokes collection remains in the original Ink object, because the extractionFlags parameter is set to CopyFromOriginal.

Dim theNewInk As Ink = _
    theInkCollector.Ink.ExtractStrokes(theDeletedStrokes, _
    ExtractFlags.CopyFromOriginal)

See Also