如下:
procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
Rect: TRect; State: TGridDrawState);
var Area:TRect;
begin
if ARow = 1 then
with StringGrid1,StringGrid1.Canvas do begin
FillRect(Rect);
Font.Color := clRed;
Area:= Rect;
InflateRect(Area, -2, -2);
DrawText(Handle, PChar(Cells[ACol, ARow]),Length(Cells[ACol, ARow]), Area, DT_CENTER);
end;
end;