Images for subitems in CListCtrl

How can I add images to subitems in a CListCtrl ?
SetItem() apparently only works for the items, i.e., the first column.
I am using "report view" for the CListCtrl.
ClausAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
MFCAnswerConnect With a Mentor Commented:
use clistctrl extended style LVS_EX_SUBITEMIMAGES
to set images for subitems. I have tried it it works.
u need not go for ownerdrawn control.





0
 
lif081199Commented:
The only way to do this is to use OwnerDraw (to draw yourself part of the control).

You will find all the help you need, including samples and ready-to-use classes here :

http://www.codeguru.com/listview/index.shtml

Good luck,
Lionel.
0
 
MFCAnswerCommented:
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
V_BapatCommented:
lif: CustomDraw is better than OwnerDraw. Try it out.
0
 
ClausAuthor Commented:
Excellent!  Just one more small question, then I'll give you the points : I use :

m_box.SetItem(row, column+1, LVIF_IMAGE, NULL,
            1, 0, 0, 0);

To display an image in a subitem - however, it doesn't show up.  Do you have an idea of what is wrong?
0
 
lif081199Commented:
Amazing !
Thanks MFCAnswer !
0
 
MFCAnswerCommented:
claus,
Sorry, I can't make out what is the problem with setItem.
U may like to check out the return parameter to know if it is setting the item successfully or not. however , i am sure that
it will work.
0
 
ClausAuthor Commented:
I figured it out - so I will give you a grade of excellent!
It puzzles me why Microsoft doesn't document their stuff better ...
0
All Courses

From novice to tech pro — start learning today.