Shoutbox

VB Win32 Coding - Listview - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Skype & Technology (/forumdisplay.php?fid=9)
+---- Forum: Tech Talk (/forumdisplay.php?fid=17)
+----- Thread: VB Win32 Coding - Listview (/showthread.php?tid=51433)

VB Win32 Coding - Listview by matty on 10-05-2005 at 08:21 PM

Ok so I have a listview box with contacts from my contact list added. Now some of them have Messenger Plus! formatted code in their names. What I am wanting to do is using the Win32 API to colour the text appropriatly. I can colour the specific line all one colour but I want to do individual text if need be.

So if anyone can help me out with it that would be great.

* matty stares at Cook :|


RE: VB Win32 Coding - Listview by CookieRevised on 10-05-2005 at 11:02 PM

well, ermmm... you're going to need to totally subclass your listview and make it owner drawn because you are going to need to draw the individual items yourself instead of letting Windows do the job.

This is no small task to do (especially considering the listview is one of the biggest Windows controls with the most possible messages and what not); making a control owner drawn is not that difficult, but handling the messages appropiatly is.

I never attempted to make subtext colored, in another font and all, so I don't have a concrete example for this. But maybe some of these can get you started:
http://www.vbaccelerator.com/home/VB/Code/Control...stView/article.asp
http://www.mvps.org/vbvision/
http://www.elitevb.com/content/01,0048,01/
ListView Ref

I never seen an example on the net which let you colorize and customize parts of items in a listview, they all do it to the whole item text (but mind the sometimes many -hidden- bugs in online examples).

I assume drawing mixed colorized text and all will also involve some GDI (font) stuff so you need to look into that also...


RE: VB Win32 Coding - Listview by RaceProUK on 10-06-2005 at 01:15 PM

ListView supports RTF (obviously), so is it possible to get an ITextServices for each item?


RE: VB Win32 Coding - Listview by CookieRevised on 10-06-2005 at 01:51 PM

quote:
Originally posted by raceprouk
ListView supports RTF (obviously), so is it possible to get an ITextServices for each item?
We're talking VB here, not C++ where you use the Windows listview. If you use the listview from the windows common controls library, then yes, if you use the listview from the ActiveX common library then no... The basic VB controls do not support RTF or unicode. Nevertheless, even in C++ you must make the listview owner drawn to be able to do this stuff as Windows does not support such things by itself; you need to program it (AFAIK).