shiyuwei
April 7th, 1999, 03:56 AM
I created an image list named m_imageList.after that,I add one bitmap and one icon to it.When I add items with the images to a list control,I met a problem. I found I can add icon successfully,but can't for bitmap.
I list the codes in the follow:
1. Create the image list with 100*100 icons and 32 bpp color depth
HIMAGELIST hImageList=ImageList_Create(100, 100, ILC_COLOR32, 0, 10);
m_imageList.Attach(hImageList);
// load the starting bitmap ("Loading..." and "Corrupt file")
CBitmap dummy;
dummy.LoadBitmap(IDB_NAILS100);
m_imageList.Add(&dummy, RGB(0, 0, 0));
m_imageList.Add(AfxGetApp()->LoadIcon(IDR_MAINFRAME));
// Use the image list in the list view
GetListCtrl().SetImageList(&m_imageList, LVSIL_NORMAL);
GetListCtrl().SetImageList(&m_imageList, LVSIL_SMALL);
2. Adding items to the list control
GetListCtrl().InsertColumn(0,"goodhead",LVCFMT_LEFT,-1,0);
int imgPos=0;
GetListCtrl().InsertItem(LVIF_IMAGE|LVIF_TEXT,0,"bitmap",0,0,imgPos,0);
imgPos=1;
GetListCtrl().InsertItem(LVIF_IMAGE|LVIF_TEXT,1,"icon",0,0,imgPos,0);
3. Result
I can see the icon image in the list,but where is the bitmap image? I don't know.
Thank you for your help!
I list the codes in the follow:
1. Create the image list with 100*100 icons and 32 bpp color depth
HIMAGELIST hImageList=ImageList_Create(100, 100, ILC_COLOR32, 0, 10);
m_imageList.Attach(hImageList);
// load the starting bitmap ("Loading..." and "Corrupt file")
CBitmap dummy;
dummy.LoadBitmap(IDB_NAILS100);
m_imageList.Add(&dummy, RGB(0, 0, 0));
m_imageList.Add(AfxGetApp()->LoadIcon(IDR_MAINFRAME));
// Use the image list in the list view
GetListCtrl().SetImageList(&m_imageList, LVSIL_NORMAL);
GetListCtrl().SetImageList(&m_imageList, LVSIL_SMALL);
2. Adding items to the list control
GetListCtrl().InsertColumn(0,"goodhead",LVCFMT_LEFT,-1,0);
int imgPos=0;
GetListCtrl().InsertItem(LVIF_IMAGE|LVIF_TEXT,0,"bitmap",0,0,imgPos,0);
imgPos=1;
GetListCtrl().InsertItem(LVIF_IMAGE|LVIF_TEXT,1,"icon",0,0,imgPos,0);
3. Result
I can see the icon image in the list,but where is the bitmap image? I don't know.
Thank you for your help!