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
 
-----Original Message-----
From: Jeremy Coulter [mailto:[EMAIL PROTECTED]]
Sent: Thursday, 17 February 2000 14:42
To: Multiple recipients of list delphi
Subject: [DUG]: Multi coloured StringGrid rows

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
 

Reply via email to