A:
procedure TForm1.Button1Click(Sender: TObject);
var
i: integer;
begin
stringGrid1.DefaultDrawing := false;
with StringGrid1 do
begin
colCount := 26;
RowCount := 99;
for i := 1 to 20 do
cells[i, 0] := chr(i + 64);
for i := 0 to 99 do
cells[0, i + 1] := IntToStr(i);
end;
end;
procedure TForm1.StringGrid1DrawCell(Sender: TObject; Col, Row: Longint;
Rect: TRect; State: TGridDrawState);
begin
if (stringGrid1.cells[col, row][1] = '1') and (Col = 0) then
begin
stringGrid1.canvas.brush.color := clMaroon;
stringGrid1.canvas.font.color := clWhite;
end
else
begin
stringGrid1.canvas.brush.color := clWhite;
stringGrid1.canvas.font.color := clMaroon;
end;
stringGrid1.canvas.fillRect(rect);
stringGrid1.canvas.TextRect(Rect, Rect.Left + 3, Rect.Top +
3, StringGrid1.cells[col, row]);
end;