ExtractStrokes(Rectangle) Method

ExtractStrokes(Rectangle) Method

Cuts or copies strokes from an existing InkDisp object and pastes them into a new InkDisp object, by using the known rectangle to determine which strokes to extract.

Declaration

[C++]

        HRESULT ExtractWithRectangle (
    [in] IInkRectangle* rectangle,
    [in, optional, defaultvalue(IEF_Default)] InkExtractFlags extractFlags,
    [out, retval] IInkDisp **ExtractedInk
);
      

[Microsoft® Visual Basic® 6.0]

        Public Function ExtractWithRectangle( _
    rectangle As InkRectangle, _
  [extractFlags As InkExtractFlags = IEF_RemoveFromOriginal] _
) As InkDisp
      

Parameters

rectangle

[in] Specifies the InkRectangle object which delimits the ink to extract from the InkDisp object.

extractFlags

[in, optional] Specifies the InkExtractFlags enumeration type, which determines whether the ink should be cut or copied from the existing InkDisp object. The default cuts the strokes from the existing InkDisp object.

ExtractedInk

[out, retval] Returns an InkDisp object that contains the extracted collection of strokes.

Return Value

HRESULT value Description
S_OK Success.
E_POINTER A parameter contained an invalid pointer.
E_INK_EXCEPTION An exception occurred inside the method.
E_INK_SOME_STROKES_NOT_EXTRACTED Not all strokes were extracted.
E_OUTOFMEMORY Cannot allocate memory to complete the operation.
E_INVALIDARG Invalid extraction flags.
REGDB_CLASSNOTREG The Ink object was not registered.

Remarks

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

This method is useful for creating a new InkDisp object without the deleted or cut strokes from the original object.

To extract strokes from a known collection of strokes, call the ExtractStrokes() method.

Only the portion of a stroke that is within the rectangle is added to the new InkDisp object.

When the extractFlags parameter is RemoveFromOriginal or Default, any strokes that cross the rectangle are split and the portion within the rectangle removed from the existing InkDisp object.

Example

[Visual Basic 6.0]

This Visual Basic 6.0 example creates an InkDisp object that contains a copy of the set of InkStrokes from the InkCollector, theInkCollector, bounded by the InkRectangle, rectSelection.

        Dim theNewInk As InkDisp
Set theNewInk = theInkCollector.Ink.ExtractStrokes(rectSelection, _
    IEF_CopyFromOriginal)

Applies To