Click to See Complete Forum and Search --> : List views and multiple fonts


Sean Newell
January 26th, 2000, 07:52 AM
Hello,

I'm trying to figure out how to get a listview
control to display listitems with different
font settings, such as typeface, strikethrough,
point size, etc.

An example of where I have seen this working is
with Microsoft Outlook. The tasks section looks
like a list view control, but completed tasks
are displayed in the strikethrough style.

I've scoured the internet trying to find someone
who has done this, but so far no joy! Can anyone
help ?

Many thanks in advance

Sean

Chris Eastwood
January 26th, 2000, 07:58 AM
If you want to display different fonts for each item in the listview, then you're going to have to get to grips with the CustomDraw notification messages that windows fires at the controls owner (ie. the form). I've written some code for VB5 (should work with the VB6 controls also, but they are a bit crappy). It also means that you're going to have to get your hands dirty with subclassing.

You can see my code here : http://codeguru.developer.com/vb/articles/htm/LVColouredItems.shtml

If that seems way too complicated for what you want to do, I'd recommend that you take a look at the 'S-Grid' component from http://vbaccelerator.com - it's free and has lots of other features (including the ones you want).





Chris Eastwood

CodeGuru - the website for developers
http://codeguru.developer.com/vb