procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
Rect: TRect; State: TGridDrawState);
var
bColor, fColor: TColor;
FName: string;
begin
case (arow mod 2 = 0) of
true:
begin
bColor := clbackground;
fColor := Clred;
FName := 'Fixedsys';
end;
false:
begin
bColor := clWhite;
fColor := Clblack;
FName := 'MS Sans Serif';
end;
end;
tdrawgrid(stringgrid1).canvas.brush.color := bColor;
tdrawgrid(stringgrid1).Canvas.Font.Color := fColor;
tdrawgrid(stringgrid1).Canvas.Font.Name := FName;
tdrawgrid(stringgrid1).Canvas.TextRect(rect,rect.Left,rect.Top,stringgrid1.Cells[acol,arow]);
end;
procedure TForm1.FormCreate(Sender: TObject);
var
I, J: Integer;
begin
for J := 0 to stringgrid1.RowCount - 1 do
for I := 0 to stringgrid1.ColCount - 1 do
stringgrid1.Cells[I, J] := 'test' + IntToStr(I) + IntToStr(J);
end;