Stroke.HitTest Method (Rect, Int32)
.NET Framework (current version)
Returns a value that indicates whether the Stroke is within the bounds of the specified rectangle.
PresentationCore (in PresentationCore.dll)
public bool HitTest(
A Rect that represents the bounds of the area to hit test.
The percentage of the length of the Stroke, that must be in percentageWithinBounds for the Stroke to be considered hit..
true if the current stroke is within the bounds of bounds; otherwise, false.
The following example renders a stroke purple if at least 80% of the stroke is within the Rect.
Rect rect1 = new Rect(100, 100, 100, 100);
if (aStroke.HitTest(rect1, 80))
aStroke.DrawingAttributes.Color = Colors.Purple;
Return to top
Available since 3.0