共用方式為


CListBox::ItemFromPoint

Determines the list-box item nearest the point specified in pt.

UINT ItemFromPoint(
   CPoint pt,
   BOOL& bOutside
) const;

Parameters

  • pt
    Point for which to find the nearest item, specified relative to the upper-left corner of the client area of the list box.

  • bOutside
    Reference to a BOOL variable which will be set to TRUE if pt is outside the client area of the nearest list box item, FALSE if pt is inside the client area of the nearest list box item.

Return Value

The index of the nearest item to the point specified in pt.

Remarks

You could use this function to determine which list-box item the mouse cursor moves over.

Example

See the example for CListBox::SetAnchorIndex.

Requirements

Header: afxwin.h

See Also

Reference

CListBox Class

Hierarchy Chart

CListBox::GetItemRect

LB_ITEMFROMPOINT

Other Resources

CListBox Members