Solved

Need some help with ImageList and CListCtrl

Posted on 2008-10-07
4
554 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 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

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…
In this post we will learn different types of Android Layout and some basics of an Android App.
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.
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

756 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