Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Need some help with ImageList and CListCtrl

Posted on 2008-10-07
4
Medium Priority
?
585 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 45

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

Enroll in October's Free Course of the Month

Do you work with and analyze data? Enroll in October's Course of the Month for 7+ hours of SQL training, allowing you to quickly and efficiently store or retrieve data. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

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.
Ready to get certified? Check out some courses that help you prepare for third-party exams.
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.
Loops Section Overview

597 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