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


Returns whether the specified path intersects the Stroke using the specified StylusShape.

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

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


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

The path that stylusShape follows for hit testing

Type: System.Windows.Ink.StylusShape

The shape of path with which to hit test.

Return Value

Type: System.Boolean

true if stylusShape intersects the current stroke; otherwise, false.

The HitTest method uses stylusShape to hit test the stroke along eraserPath.

The following code renders a stroke purple if the stroke intersects the path of myPoints.

Point[] myPoints = new Point[] {
    new Point(100, 100),
    new	Point(200, 100),
    new	Point(200, 200),
    new	Point(100, 200)};

EllipseStylusShape myStylus = new EllipseStylusShape(5.0, 5.0, 0.0);

if (aStroke.HitTest(myPoints, myStylus))
    aStroke.DrawingAttributes.Color = Colors.Purple;

.NET Framework
Available since 3.0
Return to top