要设置Options属性中的goRowSelect为True,然后StringGrid.Row := 10,改背景色写OnDrawCell事件 procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer; Rect: TRect; State: TGridDrawState); var s:String; begin if (ARow = StringGrid1.Row) and (ACol>=StringGrid1.FixedCols) then begin StringGrid1.Canvas.Brush.Color := clRed; StringGrid1.Canvas.FillRect(Rect); end; end;
procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
Rect: TRect; State: TGridDrawState);
var s:String;
begin
if (ARow = StringGrid1.Row) and (ACol>=StringGrid1.FixedCols) then
begin
StringGrid1.Canvas.Brush.Color := clRed;
StringGrid1.Canvas.FillRect(Rect);
end;
end;