procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
Rect: TRect; State: TGridDrawState);
begin
with StringGrid1.Canvas do
begin
if ACol = 0 then
Brush.Color := clred
else if ARow = 0 then
Brush.Color := clBlue
else
// Brush.Color := clyellow;
FillRect(Rect);
TextRect(Rect, rect.left+1, rect.top+1, 'Test');
end;
end;
procedure TForm1.BitBtn1Click(Sender: TObject);
var
MyRect: TGridRect;
Rect: TRect;
begin
MyRect := StringGrid1.Selection;
StringGrid1.Canvas.Brush.Color := clRed;
StringGrid1.Canvas.FillRect(TRect(MyRect));
end;