Articles   Members Online:
-Article/Tip Search
-News Group Search over 21 Million news group articles.
-Delphi/Pascal
-CBuilder/C++
-C#Builder/C#
-JBuilder/Java
-Kylix
Member Area
-Home
-Account Center
-Top 10 NEW!!
-Submit Article/Tip
-Forums Upgraded!!
-My Articles
-Edit Information
-Login/Logout
-Become a Member
-Why sign up!
-Newsletter
-Chat Online!
-Indexes NEW!!
Employment
-Build your resume
-Find a job
-Post a job
-Resume Search
Contacts
-Contacts
-Feedbacks
-Link to us
-Privacy/Disclaimer
Embarcadero
Visit Embarcadero
Embarcadero Community
JEDI
Links
ow to Use the OnDraw methods of a TListView in vsReport view style Turn on/off line numbers in source code. Switch to Orginial background IDE or DSP color Comment or reply to this aritlce/tip for discussion. Bookmark this article to my favorite article(s). Print this article
31-Oct-02
Category
VCL-General
Language
Delphi 2.x
Views
70
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
DSP, Administrator
Reference URL:
DKB
			Author: Tomas Rutkauskas

Does anyone know how to use the OnDraw methods in the TListView - vsReport? I want 
to draw both the list item and the list item's sub-items, but it seems to me that 
the OnDraw only gets called on the item. I have tried all the draw methods but 
cannot realy figure out how to draw in the subitems rect.

Answer:

You are right, it gets called by the TListItem but since you have the TListItem, 
you can draw the subitems as well. Example DrawItem:

1   { ... }
2   if Item.Index = 0 then
3     Sender.Canvas.Brush.Color := clRed
4   else
5     Sender.Canvas.Brush.Color := clYellow;
6   Sender.Canvas.FillRect(Rect);
7   for x := 0 to TListView(Sender).Columns.Count - 1 do
8     if x = 0 then
9       Sender.Canvas.TextOut(Rect.Left + 2, Rect.Top, Item.Caption)
10    else
11      Sender.Canvas.TextOut((Rect.Left + 2) + Sender.Column[x].Width,
12        Rect.Top, Item.SubItems.Strings[x - 1]);
13  { ... }


			
Vote: How useful do you find this Article/Tip?
Bad Excellent
1 2 3 4 5 6 7 8 9 10

 

Advertisement
Share this page
Advertisement
Download from Google

Copyright © Mendozi Enterprises LLC