2

I have a List View Control that I have created with Win32 C++
I am adding sub items using ListView_SetItem
This just Text and the List View is in Report Mode. I want to change the colour of the text for a particular sub Item . Can I do this? How
Thanks

Cody Gray - on strike
  • 239,200
  • 50
  • 490
  • 574
Rahul
  • 2,194
  • 4
  • 31
  • 46

2 Answers2

5

You'll need to use owner-draw for this sub item so that it uses different font properties than the rest of the list view.

David Heffernan
  • 601,492
  • 42
  • 1,072
  • 1,490
  • apparently you don't need owner draw custom draw is enough, specifically you need to handle the NM_CUSTOMDRAW – Rahul Feb 18 '11 at 14:45
  • @Rahul Custom draw, owner draw, it's all the same. I come from a Delphi background and there the terminology is owner draw. But if you want to give the accept to yourself, down-vote my answer and pretend that I didn't give you the answer, that's fine by me! ;-) – David Heffernan Feb 18 '11 at 15:26
  • actually I clicked the down vote by mistake byt every time I try and click the up vote it says its locked no idea why. I really wasnt trying to pretend anything. But thankfully its fine by you :-) – Rahul Mar 07 '11 at 20:12
  • @Rahul I've edited the question so, if you wanted, you could rescind your downvote. Anyway, it's long gone in my mind, but thanks for letting me know! – David Heffernan Mar 07 '11 at 20:14
2

It turns out you can do it using NM_CUSTOMDRAW but then you need to do a bunch of other stuff too

This article explains it really well http://www.codeproject.com/script/Articles/ArticleVersion.aspx?aid=2890&av=110402 look for the section called ListView Colors

Rahul
  • 2,194
  • 4
  • 31
  • 46