Freigeben über


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, _
ByRef lassoPoints As Point _
) As Strokes
C# public Strokes HitTest(
Point[] points,
float percentIntersect,
out Point lassoPoints
);
Managed C++ public: Strokes* HitTest(
Point *points __gc[],
float *percentIntersect,
Point **lassoPoints
);

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.
lassoPoints System.Drawing.Point[]. When this method returns, contains an out parameter that represents the specific portion of the selection boundary that is used for the selection. Because a user can draw many differently shaped boundaries, some of which overlap multiple times, this can be useful for illustrating which portion of the boundary is used for selection. This parameter is passed uninitialized.

Return Value

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

Exceptions

ObjectDisposedException Leave Site: The Ink object is disposed.

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. The actual points used to select the Stroke objects are returned in an array of Point Leave Site objects, selectedPointsUsed.

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

[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. The actual points used to select the Stroke objects are returned in an array of Point Leave Site objects, selectedPointsUsed.

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

See Also