Share via


Ink.ExtractStrokes Method

Ink.ExtractStrokes Method

Extracts the all the Stroke objects that are within the bounds of a specified rectangle, from the Ink object, and returns a new Ink object containing the extracted Strokes collection.

Definition

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

Parameters

extractionRectangle System.Drawing.Rectangle. The Rectangle Leave Site that delimits the ink to extract from the Ink object.

Return Value

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(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 in the Ink object of an InkCollector object, theInkCollector, which is bounded by the Rectangle Leave Site, rectSelection. The Strokes collection is removed from the area bounded by rectSelection in the original Ink object.

Ink theNewInk = theInkCollector.Ink.ExtractStrokes(rectSelection);

[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 in the Ink object of an InkCollector object, theInkCollector, which is bounded by the Rectangle Leave Site, rectSelection. The Strokes collection is removed from the area bounded by rectSelection in the original Ink object.

Dim theNewInk As Ink = theInkCollector.Ink.ExtractStrokes(rectSelection)

See Also