|
-
April 19th, 1999, 05:28 AM
#1
Adding icon to subitems of CListCtrl
Hi everyone !
How can I add an icon to the subitem in CListCtrl? I think it is possible using owner-drawn list control? But I don't know how.
Can someone help me?
Thanks in advance
-
April 19th, 1999, 06:23 AM
#2
Re: Adding icon to subitems of CListCtrl
You have first to create an image list and then add it to the a CListView
m_pImageList=new CImageList;
m_pImageList->Create(16,16, TRUE, 2, 0);
m_pImageList->Add(theApp.LoadIcon (IDI_LOCKICON));
m_pImageList->Add(theApp.LoadIcon(IDI_UNLOCKICON));
m_listFiles.SetImageList(m_pImageList, LVSIL_SMALL);
when you after all you want to add items you have to set the style of the item like this
item.mask = LVIF_TEXT | LVIF_IMAGE;
and the index of the image
item.iImage = 1;
I hope this helps you.
Hussam
-
April 20th, 1999, 07:11 AM
#3
Re: Adding icon to subitems of CListCtrl
Thanks for the reply Hussam. But this will only add icons to the items (which I am able to add) and not to the subitems. If you have a way to add icons to the
subitems, let me know.
Vicky
-
April 21st, 1999, 07:30 AM
#4
Re: Adding icon to subitems of CListCtrl
The LV_COLUMN structure has two new fields (Version 4.7 of common controls) that allow you to specify the placement of bitmaps (from an image list) in the various columns (iImage and iOrder). Check them out. Earlier versions require complete owner-draw....
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|