Solved

Need some help with ImageList and CListCtrl

Posted on 2008-10-07
4
518 Views
Last Modified: 2013-11-20
Hello,
I would like to add an Icon to my CListCtrl.
With my code I can only add the Icon to the first column of each row.
I would like to add the Icon on other columns.
Please let me know.
500 poinst with a solution.
Best regards,
Thomas

CImageList m_image;

m_image.Create(32,32,ILC_COLOR16|ILC_MASK,1,1);

	 

	m_image.Add(AfxGetApp()->LoadIcon(IDI_ICON1));

	m_List.SetImageList(&m_image,LVSIL_SMALL);

Open in new window

0
Comment
Question by:tsp2002
4 Comments
 
LVL 44

Expert Comment

by:AndyAinscow
ID: 22657087
Owner draw - I think that is your only solution.
You have to then draw the content of the 'cells' yourself.
0
 
LVL 19

Accepted Solution

by:
alb66 earned 250 total points
ID: 22657119
0
 
LVL 39

Assisted Solution

by:itsmeandnobodyelse
itsmeandnobodyelse earned 250 total points
ID: 22658755
In YourDialog::OnInitDialog you would do like

  DWORD exStyle = m_listCtrl.GetExtendedStyle();
  exStyle |= LVS_EX_SUBITEMIMAGES;
  m_listCtrl.SetExtendedStyle(exStyle );

To add subimages you would use the SetItem for example

   m_listCtrl.SetItem(item, column, LVIF_IMAGE, NULL, imageIdx, 0, 0, 0);
 
0
 

Author Closing Comment

by:tsp2002
ID: 31503726
LVS_EX_SUBITEMIMAGES....that works...thanks a lot
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now