BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Listview - Change the color of a ROW at insert

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> comp.lang.pascal.delphi.components.misc
View previous topic :: View next topic  
Author Message
bmattuSpam@yahoo.com
Guest





PostPosted: Thu Jun 09, 2005 7:47 am    Post subject: Listview - Change the color of a ROW at insert Reply with quote



Hi

I would like to know how one can change the color of a row in listview.
I am populating a listview using a dataset and if a ercord meets a
particular condition the color of that row needs to be changed.

Does anyone have any ideas?

Thanks
Matt

Back to top
Tony Mountifield
Guest





PostPosted: Mon Jun 13, 2005 3:23 pm    Post subject: Re: Listview - Change the color of a ROW at insert Reply with quote



In article <1118303277.514934.300620 (AT) g43g2000cwa (DOT) googlegroups.com>,
[email]bmattuSpam (AT) yahoo (DOT) com[/email] <bmattu (AT) yahoo (DOT) com> wrote:
Quote:
Hi

I would like to know how one can change the color of a row in listview.
I am populating a listview using a dataset and if a ercord meets a
particular condition the color of that row needs to be changed.

Does anyone have any ideas?

Use the OnCustomDrawItem event.

See http://www.delphidabbler.com/articles.php?article=16 for examples.

Here's an example too, where if condition1 is true, the row's background
colour is changed, and if condition2 is true, the text is set to be
bold and in blue:

{------------------------------------------------------------------}
procedure TForm1.ListView1CustomDrawItem(Sender: TCustomListView;
Item: TListItem; State: TCustomDrawState; var DefaultDraw: Boolean);
begin
if condition1 then
begin
Sender.Canvas.Brush.Color := $FFFFCC;
end;

if condition2 then
begin
Sender.Canvas.Font.Style := [fsBold];
Sender.Canvas.Font.Color := clBlue;
end;
end;
{------------------------------------------------------------------}

Cheers
Tony

--
Tony Mountifield
Work: [email]tony (AT) softins (DOT) co.uk[/email] - http://www.softins.co.uk
Play: [email]tony (AT) mountifield (DOT) org[/email] - http://tony.mountifield.org

Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> comp.lang.pascal.delphi.components.misc All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.