Ink.ExtractStrokes Method

Ink.ExtractStrokes Method

Extracts the all the Stroke objects within the bounds of a specified rectangle from the Ink object by using either cut or copy, as specified, and returns a new Ink object containing the extracted Strokes collection.

Definition

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

Parameters

> > >
extractionRectangle System.Drawing.Rectangle. The Rectangle Leave Site that delimits the ink to extract from the Ink object.
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

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.

This method is useful for creating a new Ink object if you do not have references to the Stroke objects to extract from the original Ink object.

To extract a known Strokes collection, call the ExtractStrokes(Strokes) or ExtractStrokes(Strokes,ExtractFlags) method.

Only the portion of a Stroke object within the rectangle is added to the new Ink object. When the extractionFlags parameter is set to RemoveFromOriginal or Default, any Stroke objects that cross the boundary of the rectangle are split and the portion within the rectangle removed from the original Ink object.

Examples

[C#]

This C# example creates a new Ink object, theNewInk. The new Ink object contains a copy of the Strokes collection from the Ink object that is in an InkCollector object, theInkCollector, and that is bounded by the Rectangle Leave Site, rectSelection. The Strokes collection is preserved in the original Ink object, because the extractionFlags parameter is set to CopyFromOriginal.

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

[Visual Basic .NET]

This Microsoft® Visual Basic® .NET example creates a new Ink object, theNewInk. The new Ink object contains a copy of the Strokes collection from the Ink object that is in an InkCollector object, theInkCollector, and that is bounded by the Rectangle Leave Site, rectSelection. The Strokes collection is preserved in the original Ink object, because the extractionFlags parameter is set to CopyFromOriginal.

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

See Also