24 LPDRAWITEMSTRUCT aDrawItem
28 CRect rcItem( aDrawItem->rcItem );
29 UINT nIndex = aDrawItem->itemID;
30 if( (
int)nIndex >= 0 )
37 GetText( nIndex, itemText );
38 compareText = itemText;
39 compareText = compareText.MakeLower();
41 if( aDrawItem->itemState & ODS_SELECTED )
43 rgbBkGnd = ::GetSysColor( COLOR_HIGHLIGHT );
44 rgbText = ::GetSysColor( COLOR_HIGHLIGHTTEXT );
46 else if( !mSearchString.IsEmpty() && compareText.Find( mSearchString, 0 ) != -1 )
48 rgbBkGnd = RGB( 255, 255, 0 );
49 rgbText = RGB( 0, 0, 0 );
53 rgbBkGnd = RGB( 255, 255, 255 );
54 rgbText = RGB( 0, 0, 0 );
56 dc.Attach( aDrawItem->hDC );
58 if( aDrawItem->itemState & ODS_FOCUS )
59 dc.DrawFocusRect( rcItem );
61 CBrush br( rgbBkGnd );
62 dc.FillRect( rcItem, &br );
63 dc.SetBkColor( rgbBkGnd );
64 dc.SetTextColor( rgbText );
65 dc.TextOut( rcItem.left + 2, rcItem.top + 2, itemText );
void setSearchString(CString aSearchString)
Set the search string to use.
CString mSearchString
The search string to match.
CString getSearchString() const
Get the search string being used.
void DrawItem(LPDRAWITEMSTRUCT aDrawItem)
Draw the list item specified by aDrawItem.