Stroke.HitTest Method (Point)


Returns a value that indicates whether current Stroke intersects the specified point.

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

public bool HitTest(
	Point point


Type: System.Windows.Point

The Point to hit test.

Return Value

Type: System.Boolean

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

This method behaves the same way as the overloaded HitTest(Point, Double) method does when diameter is 1.

The following example changes the color of a Stroke if it intersects a certain area.

Point myPoint = new Point(100, 100);

if (myStroke.HitTest(myPoint, 10))
    myStroke.DrawingAttributes.Color = Colors.Red;

.NET Framework
Available since 3.0
Return to top