Share via


Ink.HitTest Method (array<Point[], Single, array<Point[]%)

Returns the Strokes collection contained within a polyline selection boundary.

Namespace:  Microsoft.Ink
Assembly:  Microsoft.Ink (in Microsoft.Ink.dll)

Syntax

'Declaration
Public Function HitTest ( _
    points As Point(), _
    percentIntersect As Single, _
    <OutAttribute> ByRef lassoPoints As Point() _
) As Strokes
'Usage
Dim instance As Ink 
Dim points As Point()
Dim percentIntersect As Single 
Dim lassoPoints As Point()
Dim returnValue As Strokes 

returnValue = instance.HitTest(points, _
    percentIntersect, lassoPoints)
public Strokes HitTest(
    Point[] points,
    float percentIntersect,
    out Point[] lassoPoints
)
public:
Strokes^ HitTest(
    array<Point>^ points, 
    float percentIntersect, 
    [OutAttribute] array<Point>^% lassoPoints
)
public function HitTest(
    points : Point[], 
    percentIntersect : float, 
    lassoPoints : Point[]
) : Strokes

Parameters

  • points
    Type: array<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
    Type: System.Single

    Percentage by which the intersection must overlap to be a hit.

  • lassoPoints
    Type: array<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

Type: Microsoft.Ink.Strokes
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 nulla null reference (Nothing in Visual Basic) (Nothing in Microsoft Visual Basic.NET) or contains fewer than three points.

Examples

This C# example uses an array of Point 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 objects, selectedPointsUsed.

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

This Microsoft Visual Basic.NET example uses an array of Point 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 objects, selectedPointsUsed.

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

Platforms

Windows 7, Windows Vista, Windows Server 2008 R2, Windows Server 2008

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Version Information

.NET Framework

Supported in: 3.0

See Also

Reference

Ink Class

Ink Members

HitTest Overload

Microsoft.Ink Namespace

Strokes

ExtendedProperties