Share via


Working with a Strokes Collection

Working with a Strokes Collection

Overview of working with a Strokes collection.

The Strokes collection that the Divider object analyzes is kept in the Strokes property of the Divider object. Since a Strokes collection is a reference to ink data and is not the actual data itself, changes in the parent Ink object of the Strokes collection can invalidate the Strokes collection. For more information about ink data, see Ink Data. For more information about ink collection, see Ink Collection.

To keep the Strokes property of the Divider object synchronized with an Ink object, use the InkAdded and InkDeleted events of the Ink object to listen for strokes that should be added or removed from the Divider object. This covers cases where strokes are added to, deleted from, clipped, or split within the Ink object.

Note: Moving, scaling, or other transformations on strokes in the Ink object do not generate InkAdded or InkDeleted events. To reflect such a transformation in the Strokes property of the Divider object, perform the same transformation on the strokes in the Divider object.

The Strokes property of the DivisionResult object contains a copy of the strokes in the Divider object at the time the DivisionResult object was created. You can compare the Strokes properties of two DivisionResult objects to determine if the strokes have changed between the two times the Divide method was called.

The Strokes property of the DivisionUnit object contains the subset of the strokes in the DivisionResult object that correspond to this element. You can pass these strokes to a separate recognizer context to get a recognition result for the element. Since handwriting elements exist at different levels of detail, the Strokes collections for different elements may overlap. For example, the Strokes collection for a recognition segment element will be a subset of the Strokes collection for the line element of which the recognition segment is a part.