 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
bmattuSpam@yahoo.com Guest
|
Posted: Thu Jun 09, 2005 7:47 am Post subject: Listview - Change the color of a ROW at insert |
|
|
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
|
Posted: Mon Jun 13, 2005 3:23 pm Post subject: Re: Listview - Change the color of a ROW at insert |
|
|
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 |
|
 |
|
|
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
|
|