怎么为CCombox左端添加一个图标

如何为CCombox左端添加一个图标
我现在需要在一个登陆界面的用户名下拉菜单组合框,该组合框里需要添加一个图标,请大侠帮忙指点

------解决方案--------------------
1.创建一个CComboBoxEx控件
2.关联图标用SetImageList()函数
3.设置COMBOBOXEXITEM结构体,其中mask成员要设置CBEIF_IMAGE | CBEIF_SELECTEDIMAGE | CBEIF_TEXT | CBEIF_LPARAM
4.调用InsertItem()显示。

------解决方案--------------------
http://wenku.baidu.com/view/646cc446a8956bec0975e39f.html
------解决方案--------------------
//onerdraw: variable
class CMyComboBox : public CComboBox

void CMyComboBox::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct) 
{
if (GetCount() == 0 || (int)lpDrawItemStruct->itemID > GetCount()) return;
// check style
LPTSTR str=0;
CString tmp;
if(GetWindowLong(GetSafeHwnd(),GWL_STYLE) & CBS_HASSTRINGS)
{
GetLBText(lpDrawItemStruct->itemID,tmp);
str=(LPTSTR)tmp.GetBuffer(40);
}
else
{
str=(LPTSTR) GetItemData(lpDrawItemStruct->itemID);
}
//
CDC dc;
BOOL bSelected = FALSE;

dc.Attach(lpDrawItemStruct->hDC);

// Save these value to restore them when done drawing.
COLORREF crOldTextColor = dc.GetTextColor();
COLORREF crOldBkColor = dc.GetBkColor();

// If this item is selected, set the background color and the text color to appropriate 
// values. Erase the rect by filling it with the background color.
CRect rect(lpDrawItemStruct->rcItem);
//
if ((lpDrawItemStruct->itemAction | ODA_SELECT) &&
(lpDrawItemStruct->itemState & ODS_SELECTED))
{
dc.SetTextColor(::GetSysColor(COLOR_HIGHLIGHTTEXT));
dc.SetBkColor(::GetSysColor(COLOR_HIGHLIGHT));
dc.FillSolidRect(&rect, ::GetSysColor(COLOR_HIGHLIGHT));
bSelected = TRUE;
}
else
{
dc.FillSolidRect(&rect, crOldBkColor);
}
// If we use images
if (m_pImageList)
{
LPTSTR irTxt=(LPTSTR) GetItemData(lpDrawItemStruct->itemID);
int orignalID=GetOrignalIndex(irTxt);
DrawIconEx(dc.GetSafeHdc(),rect.left+1,rect.top+1,
m_pImageList->ExtractIcon(m_baImageIndex[orignalID]),
0, 0, 0, NULL, DI_NORMAL);
}
// If we use images - move text to the right:
if (m_pImageList)
{
IMAGEINFO sImageInfo;//use the 1st(0) item
m_pImageList->GetImageInfo(0, &sImageInfo);
rect.left += sImageInfo.rcImage.right;
rect.left += sImageInfo.rcImage.right/2;
}
// Normal one column text display:
dc.DrawText(str, -1, &rect, DT_LEFT|DT_SINGLELINE|DT_VCENTER);
// Reset the background color and the text color back to their original values.
dc.SetTextColor(crOldTextColor);
dc.SetBkColor(crOldBkColor);
//
dc.Detach();
}
//
void CMyComboBox::SetItemImage(int nItemIndex, int nImageIndex)
{
m_baImageIndex[nImageIndex] = nImageIndex;
Invalidate();
}