Using MFC and CListCtrl and adding icons in one column

am using Visual C++ 6.0 and MFC. I am using a dialog based project and would like to have a single column of icons so to speak (4 rows x 1 column) stacked one on top of another like the window on the left located at the following link

http://www.flickr.com/photos/14402427@N02/3286122071/

I have imported the icons into the resource section so these icons have IDs such as IDI_ICON1 and IDI_ICON2 and IDI_ICON3 and IDI_ICON4. I only want four (4) icons stacked in one single column.

Here is what I have tried thus far and it does not work. Nothing shows up in my CListCtrl window. No icons.

CImageList * myImageList = new CImageList;

myImageList->Create(32, 32, ILC_COLOR32, 0, 2) ;
myImageList->Add(AfxGetApp()->LoadIcon(IDI_ICON1));
myImageList->Add(AfxGetApp()->LoadIcon(IDI_ICON1));
m_mainlistview.SetImageList(myImageList, LVSIL_SMALL);

Comments

  • Thanks everyone I've got it working. I've managed to insert icons with labels within my CListCtrl. Will post back if I run into more issues. Thanks.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion