TListView - Owner Draw?

Giganews Newsgroups
Subject:TListView - Owner Draw?
Posted by: Jaeden "Sifo Dyas"al'Raec Ruiner (nospam@wayoftheleaf.net)
Date:Fri, 16 Mar 2007

Well,

I've often tried to do the owner draw bit but I never seem to get it right,
so I have come to the classroom to learn.
What I want is simple, or at least simple enough, since I like the vsReport
stile of the TListView, however I would like some particular controls over
the individual "cells".
I know they aren't really cells, but visually that's what they look like.

Anyway, given TListView:

Field    Value //Column Heads
Start    X,Y
Finish    X,Y
  Dif    X,Y

You may notice (or not given the formatting of the news post) that "Dif" is
indented.  Now I could hack it and use a couple of spaces, but Instead I
would like to add individual Item/SubItem processessing that will add these
two main things to each "Item" (and possibly SubItem in the future but that
isn't the issue now):

Alignment - Left, Center, Right
FontStyle - Bold, Italic, Underline

Now, I thought I would have to do this via the OwnerDraw so I set up the
event, and when I got the Rect I did a simple:

begin
  List:=(Sender as TListView);
  List.Canvas.TextOut(Rect.Left, Rect.Top, Item.Caption);
end;

Nothing happened.  No text was displayed, nothing.
So I don't know what I'm doing wrong here.  Now there is a possibility I
could skip this and use the AdvancedCustomDraw or CustomDraw methods, but
I'm not sure how I would be able to affect an individual Cell without
affecting the entire column/row.

Thanks

Jaeden "Sifo Dyas" al'Raec Ruiner
Fluffy

--
Jaeden "Sifo Dyas" al'Raec Ruiner
aka Fluffy
http://www.wayoftheleaf.net/

Replies