HitTest Method (IEnumerable(Point), StylusShape)
Collapse the table of content
Expand the table of content

StrokeCollection.HitTest Method (IEnumerable<Point>, StylusShape)


Returns a collection of strokes that intersect with the specified path.

Namespace:   System.Windows.Ink
Assembly:  PresentationCore (in PresentationCore.dll)

public StrokeCollection HitTest(
	IEnumerable<Point> path,
	StylusShape stylusShape


Type: System.Collections.Generic.IEnumerable<Point>

An array to type Point that represents the path to be hit tested.

Type: System.Windows.Ink.StylusShape

The StylusShape that specifies the shape of eraserPath.

Return Value

Type: System.Windows.Ink.StrokeCollection

A StrokeCollection of strokes that intersect with path.

The following example changes the color of all the strokes that intersect the path that is created by the Point array. This example assumes that there is an InkPresenter called presenter.

private void HitTestWithEraser(Point[] points)
    RectangleStylusShape eraser = new RectangleStylusShape(3, 3, 0);

    StrokeCollection strokes = presenter.Strokes.HitTest(points, eraser);

    foreach (Stroke s in strokes)
        s.DrawingAttributes.Color = Colors.Purple;

.NET Framework
Available since 3.0
Return to top
© 2016 Microsoft