Ink.HitTest Method

Ink.HitTest Method

Returns the Strokes collection contained within a polyline selection boundary.

Definition

Visual Basic .NET Public Function HitTest( _
ByVal points() As Point, _
ByVal percentIntersect As Single _
) As Strokes
C# public Strokes HitTest(
Point[] points,
float percentIntersect
);
Managed C++ public: Strokes* HitTest(
Point *points __gc[],
float *percentIntersect
);

Parameters

points System.Drawing.Point[]. The points that are used in the selection boundary to select the Stroke objects. The selection area is the area inside the selection boundary in which the boundary first intersects itself.
percentIntersect System.Single. The percentage value that determines which Stroke objects are included in the Strokes collection. If zero (0), all Stroke objects contained within or intersected by the selection boundary are included in the resulting Stroke collection. If 100, only Stroke objects fully contained in the selection boundary are included in the Strokes collection. Stroke objects that intersect the selection boundary are included in the collection if the percentage of points in those Stroke objects contained within the selection boundary is greater than or equal to the percentIntersect percentage. Fractional percentages are rounded up.

Return Value

Microsoft.Ink.Strokes. Returns the Strokes collection contained within the specified area.

Remarks

If the selection boundary does not intersect itself, the HitTest method adds a point to the end of the array to create a straight line from the first point to the last point. If the boundary is a straight line with no area within the selection boundary, no Stroke objects are selected.

This method throws an exception if the points parameter is null (Nothing in Microsoft® Visual Basic® .NET) or contains fewer than three points.

Examples

[C#]

This C# example uses an array of Point Leave Site objects, theSelectionBoundary, to select a Strokes collection from an Ink object, theInk. The percentIntersect parameter is set to 50.0, so a Stroke object must have at least 50 percent of its points contained within the selection boundary to be included in the Strokes collection, theStrokes.

Strokes theStrokes = theInk.HitTest(theSelectionBoundary, 50.0f);

[Visual Basic .NET]

This Visual Basic .NET example uses an array of Point Leave Site objects, theSelectionBoundary, to select a Strokes collection from an Ink object, theInk. The percentIntersect parameter is set to 50.0, so a Stroke object must have at least 50 percent of its points contained within the selection boundary to be included in the Strokes collection, theStrokes.

Dim theStrokes As Strokes = theInk.HitTest(theSelectionBoundary, 50.0)

See Also