This is my onDrawCell, works fine in my case. Could be used for any StringGrid using (sender as ...)
procedure TForm1.StringGrid1DrawCell(Sender: TObject; Col, Row: Integer;
aRect: TRect; aState: TGridDrawState);
const
Colores:array[0..3] of TColor=($ffefef, $efffef, $efefff, $efffff);
ColSele:array[0..3] of TColor=($444444, $444444, $444444, $444444);
begin
if not (gdFixed in aState) then // si no es el tituloŽ
if not (gdSelected in aState) then
begin
(Sender as TStringGrid).Canvas.Brush.Color:=Colores[Row mod 4];
end
else
begin
(Sender as TStringGrid).Canvas.Brush.Color:=ColSele[Row mod 4];
(Sender as TStringGrid).Canvas.Font.Color:=$ffffff;
//(Sender as TStringGrid).Canvas.Font.Style:=[fsBold];
end;
//(Sender as TStringGrid).DefaultDrawColumnCell(Rect,DataCol,Column,State);
(Sender as TStringGrid).defaultdrawcell(col,row,arect,astate);
end;
I hope you can adapt it. Excuse my bad English. Enjoy!