----- Original Message -----
Sent: Thursday, 17 February 2000 9:28
pm
Subject: RE: [DUG]: Multi coloured
StringGrid rows --- a better description
No, the story is, that I am displaying some data I
am capturing from an external device, in a string grid.
Some of the data, i.e. if the data contains the
word FIRE or ALARM or the like, I want to paint the background of the row
this appears in, in say RED.
Then if some other data comes in, I might want to
paint THIS datas row insay GREEN or some colour anyway, but it could be 2 or
4 or 20 rows later.
I
can do this BUT only if I specify the row....i.e. if row = 6 then
canvas.brush.color:=clred etc.
BUT if I try to paint in normally, i.e. if
Description = "FIRE" then canvas.brush.color:=clred etc. it will paint ALL
the rows red not the one I WANT to be red.
I
have tried in the onDrawCell event to do something silly like, if ARow =
ARow then...do the color stuff, and also, if ARow = StringGrid1.RowCount-1
then do the colour stuff, but with no success.
Way I am trying figure out, and this is what I need
some help on is, how to just paint hte ONE row a colour, and another row
another colour, and not them all the same colour.
Is
this a better description of what I am trying to do ??
Cheers, Jeremy Coulter
I understand that you're
trying to paint individual cells by position. With DefaultDrawing =
False, using the OnDrawCell event you'd do something
like:
procedure
TSurrealGridForm.sgSurrealDrawCell(Sender: TObject; ACol, ARow:
Integer;
Rect: TRect; State: TGridDrawState);
begin
with Sender as TStringGrid, Canvas, Brush do begin
case ARow * ACol mod 4 of
3: Color :=
clWhite;
2: Color :=
clBlue;
1: Color :=
clRed;
else Color :=
clGreen;
end;
FillRect(Rect);
end;
end;
Does that help at all? I only
understood about half of your problem...
:)
Cheers,
Carl
Hi
all.
I have a
string grid that I want to display diff. row colours
in.
i.e. row 1 =
red, row = blue, row 3= green etc.
I have been
spending time figuring this ut, BUT the thing is, unless I specify a row,
all the rows change colour.
This is a
problem as I dont always know WHAT the coloumn number is, i.e. I cant add
an item and then go, if ARow = Arow then blah as this didn't work
either.
Can anyone
help me out here ?
Jeremy Coulter (manager)
Visual
Software Solutions
110 Harewood Road
Christchurch
ph +64 3 3521595
fx
+64 3 3521596
cell +21 2533214
http://www.vss.co.nz