You need to add some bitmaps to your CImageList
after you have created it. Something like this:
m_myImageList.Create(84,71, ILC_COLOR8 |ILC_MASK , 8, 1);
CBitmap bm;
bm.LoadBitmap(IDB_BITMAP1);
m_myImageList.Add(&bm, RGB(0, 0, 0));
bm.LoadBitmap(IDB_BITMAP2);
m_myImageList.Add(&bm, RGB(0, 0, 0));
Then, attach it to the CListCtrl
:
m_sentToCListCtrl.SetImageList(&m_imageList, LVSIL_SMALL);
Finally, you add items to your CListCtrl
by using the InsertItem
method:
LVITEM lvItem;
lvItem.iItem = 0;
lvItem.iImage = 0; // image index that refers to your image list
lvItem.pszText = L"Item 1";
lvItem.mask = LVIF_TEXT;
m_sentToCListCtrl.InsertItem(&lvItem);
For more info refer to CListCtrl
documentation. There are examples too.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…