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?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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:
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
MFCAnswerCommented:
0
Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
System Programming

From novice to tech pro — start learning today.