Partager via


Split Method

Split Method

Splits the stroke at the specified location on the stroke.

Declaration

[C++]

        HRESULT Split (
    [in] float index,
    [out, retval] IInkStrokeDisp **NewStroke
);
      

[Microsoft® Visual Basic® 6.0]

        Public Function Split( _
    index As Single _
) As IInkStrokeDisp
      

Parameters

index

[in] The floating point index value that represents where to split the stroke.

Note: A floating point index is a float value that represents a location somewhere between two points in the stroke. As examples, if 0.0 is the first point in the stroke and 1.0 is the second point in the stroke, 0.5 is halfway between the first and second points. Similarly, a floating point index value of 37.25 represents a location that is 25 percent along the line between points 37 and 38 of the stroke.

NewStroke

[out] Returns the new IInkStrokeDisp object that is created from the split operation.

Return Value

HRESULT value Description
S_OK Success.
E_POINTER A parameter contained an invalid pointer.
E_OUTOFMEMORY Cannot allocate Stroke handler helper object.
E_INVALIDARG The parameter is invalid.
E_UNEXPECTED Unexpected parameter or property type.
E_INK_EXCEPTION An exception occurred inside the method.

Remarks

This method inserts the new stroke immediately after the original stroke in the stroke set and renumbers the remaining stroke indices.

When an IInkStrokeDisp is split, the beginning portion of the stroke remains the ID of the original IInkStrokeDisp. The end portion of the IInkStrokeDisp becomes a new IInkStrokeDisp with an ID that is one greater than the highest IInkStrokeDisp ID. If the original IInkStrokeDisp was in an InkStrokes collection (other than the Ink.Strokes), only the beginning portion remains in that collection. The following code shows how to add the end portion to that collection.

           Dim endSegmentOfSplitStroke As IInkStrokeDisp
    Set endSegmentOfSplitStroke = Stroke.Split(splitIndex)
    theStrokes.Add endSegmentOfSplitStroke
      

Example

[Visual Basic 6.0]

This Visual Basic 6.0 example splits an IInkStrokeDisp theStroke at the location specified by theSplitFIndex.

        Dim theNewStroke As IInkStrokeDisp
Set theNewStroke = theStroke.Split(theSplitFIndex)
      

Applies To