?
Solved

Need some help with ImageList and CListCtrl

Posted on 2008-10-07
4
Medium Priority
?
574 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 1000 total points
ID: 22657119
0
 
LVL 39

Assisted Solution

by:itsmeandnobodyelse
itsmeandnobodyelse earned 1000 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
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.
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

801 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