自己派生了一个CListBox的子类
void CMylist::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
{
// TODO: 在此处添加消息处理程序代码
CDC dc,memdc;
dc.Attach(lpDrawItemStruct->hDC);
CRect rect= lpDrawItemStruct->rcItem;
int nindex=lpDrawItemStruct->itemID;

if((lpDrawItemStruct->itemState&ODS_SELECTED)&&(lpDrawItemStruct->itemAction|ODA_SELECT))
//if(cursel==nindex)
{CBrush brh(RGB(255,0,0));
dc.FillRect(rect,&brh);
}
memdc.CreateCompatibleDC(&dc);
CBitmap bmp,*poldbmp;
bmp.LoadBitmapW(IDB_BITMAP2);
BITMAPINFO bmpinfo;
bmp.GetObject(sizeof(BITMAPINFO),&bmpinfo);
int cxbmp=bmpinfo.bmiHeader.biWidth;
int cybmp=bmpinfo.bmiHeader.biHeight;
poldbmp=memdc.SelectObject(&bmp);
dc.StretchBlt(rect.left,rect.top,rect.Height(),rect.Height(),&memdc,0,0,cxbmp,cybmp,SRCAND);
bmp.DeleteObject();
memdc.DeleteDC();

rect.left+=rect.Height();
dc.SetBkMode(TRANSPARENT);
          LPCTSTR pstr=(LPCTSTR)lpDrawItemStruct->itemData;
dc.DrawText(pstr,rect,DT_LEFT);
         dc.Detach();

}当调用Addstring时   如果直接用dlg.Addstring(_T("文本"))不会出错
但用一个局部两CString str("文本"); dlg.Addstring(str);  列表项里显示的就是乱码
谁给解决一下啊