int GetItemRect( int nIndex, LPRECT lpRect ) const;
Return Value
LB_ERR if an error occurs.
Parameters
nIndex
Specifies the zero-based index of the item.
lpRect
Specifies a long pointer to a RECT tructure that receives the list-box client coordinates of the item.
Remarks
Retrieves the dimensions of the rectangle that bounds a list-box item as it is currently displayed in the list-box window.
Example
// The pointer to my list box.
extern CListBox* pmyListBox;
// Dump all of the items bounds.
#ifdef _DEBUG
CString str;
RECT r;
for (int i=0;i < pmyListBox->GetCount();i++)
{
pmyListBox->GetItemRect( i, &r );
str.Format(_T("item %d: left = %d, top = %d, right = %d,
bottom = %d\r\n"),
i,
r.left,
r.top,
r.right,
r.bottom);
afxDump << str;
}
#endif
CListBox Overview | Class Members | Hierarchy Chart
See Also LB_GETITEMRECT