HitTest (StrokeCollection)


Returns a collection of strokes that are intersected by the points in a specified StylusPointCollection.

retval = object.HitTest(stylusPoints)



The collection of stylus points used to check for intersection with the StrokeCollection.

Type: StrokeCollection

A collection of strokes that are intersected by the points in the specified StylusPointCollection.

For a StrokeCollection sc that contains strokes S0 - S2, and a StylusPointCollection spc that contains points P0 - P3, the following HitTest call:


returns a StrokeCollection that containing S1 and S2.

Hit-test results

Hit-Test for StrokeCollection

// Add the new points to the Stroke we're working with
// or delete strokes if we are in erase mode.
function inkPresenterMouseMove(sender, args)
    var stylusPoints = args.getStylusPoints(sender);
    // Erase Mode?
    if (lastErasePoint != null)
        // Connect the point from previous mouse event
        // to the current collection of stylus points.
        stylusPoints.insert(0, lastErasePoint);
        var hitStrokes = sender.strokes.hitTest(stylusPoints);

        // Remove the strokes that were intersected above.
        for (var i = 0; i < hitStrokes.Count; i++)
        // Update the cached last erase point.
        lastErasePoint = stylusPoints.getItem(stylusPoints.count-1);

    // Ink Mode?
    if (newStroke != null)

Community Additions