Compartir a través de


Ink.HitTest Method (Point[], Single, 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 Strokes HitTest (
    Point[] points, 
    float percentIntersect, 
    /** @attribute OutAttribute() */ /** @ref */ Point[] lassoPoints
)
Not applicable.

Parameters

  • points
    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
    Percentage by which the intersection must overlap to be a hit.
  • lassoPoints
    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

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

Example

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 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

Version Information

.NET Framework

Supported in: 3.0

See Also

Reference

Ink Class
Ink Members
Microsoft.Ink Namespace
Strokes
ExtendedProperties