// Get the image index and selected/focused state of the
// item being drawn.
ZeroMemory ( &rItem, sizeof(LVITEM) );
rItem.mask = LVIF_IMAGE | LVIF_STATE;
rItem.iItem = nItem;
rItem.stateMask = LVIS_SELECTED | LVIS_FOCUSED;
m_agentList.GetItem ( &rItem );
// Get the rect that holds the item's icon.
m_agentList.GetItemRect ( nItem, &rcItem, LVIR_ICON );
// Draw the background & prep the DC for the text drawing. Note
// that the entire item RECT is filled in, so this emulates the full-
// row selection style of normal lists.
pDC->FillSolidRect ( rcItem, crBkgnd );
pDC->SetBkMode ( TRANSPARENT );
// Tweak the rect a bit for nicer-looking text alignment.
rcText = rcItem;
// Draw the text.
sText = m_agentList.GetItemText ( nItem, 0 );