Partager via


HitTest(Point[], Single) Method [InkDisp Class]

HitTest(Point[], Single) Method [InkDisp Class]

Retrieves the strokes within a polyline selection area.

Declaration

[C++]

HRESULT HitTestWithLasso (
    [in] VARIANT points,
    [in] float percentIntersect,
    [in, out, optional, defaultvalue(0)] VARIANT* lassoPoints,
    [out, retval] IInkStrokes **Strokes
);

[Microsoft® Visual Basic® 6.0]

Public Function HitTestWithLasso( _
    points, _
    percentIntersect As Single, _
    [lassoPoints] _
) As InkStrokes;

Parameters

points

[in] The points that are used in the lasso to select the strokes. The selection area is the area inside the selection boundary in which the boundary first intersects itself. If the boundary does not intersect itself, the 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 (no area within the selection boundary), no strokes are selected.

For more information about the VARIANT structure, see Using the Automation Library.

percentIntersect

[in] The percentage of stroke points that must be contained within the lasso to include the stroke in the resulting collection of strokes. If zero (0), all strokes that are contained within or intersected by the lasso are included in the resulting collection of strokes. If 100, only strokes fully contained in the lasso are included in the collection. Strokes that intersect the lasso are included in the collection if the percentage of points in those strokes contained within the lasso is greater than or equal to the percentIntersect percentage. Fractional percentages are rounded up.

lassoPoints

[out, optional] Returns the specific portion of the selection lasso that is used for the selection. Because a user can draw many different types of lassos, some of which overlap multiple times, this can be useful for illustrating which portion of the lasso was used for selection. The default value is a NULL pointer (Nothing in Visual Basic 6.0), which means no information is returned.

Note: In Visual Basic 6.0, this parameter may not be omitted if late binding is used. Instead, the default value of Nothing must be explicitly specified.

For more information about the VARIANT structure, see Using the Automation Library.

Strokes

[out] Returns the collection of strokes that makes up the ink.

Return Value

HRESULT value Description
S_OK Success.
E_POINTER A parameter contained an invalid pointer.
E_INK_EXCEPTION An exception occurred inside the method.
E_INVALIDARG Invalid display handle.
E_OUTOFMEMORY Cannot allocate memory operation.

Example

[Visual Basic 6.0]

This Visual Basic 6.0 example shows how to use a Variant array of Long values representing points arranged as x0, y0, x1, y1, etc. as theLasso, to select an InkStrokes collection from InkDisp, theInk. The percentIntersect parameter is set to 50.0, so a stroke must have at least 50 percent of its points contained within the lasso to be included in the collection.

Dim theStrokes As InkStrokes
Set theStrokes = theInk.HitTestWithLasso(theLasso, 50.0!)

Applies To