...
type
TStringGrid = class(Grids.TStringGrid);
TForm1 = class(TForm)
StringGrid1: TStringGrid;
btnDelete: TButton;
procedure FormCreate(Sender: TObject);
procedure btnDeleteRowClick(Sender: TObject);
private
public
end;
var
Form1: TForm1;
implementation {$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
var
c,r,x: Integer;
begin
x := 0;
StringGrid1.Rows[0].CommaText := 'COL1,COL2,COL3,COL4,COL5';
for r := StringGrid1.FixedRows to StringGrid1.RowCount-1 do
for c := StringGrid1.FixedCols to StringGrid1.ColCount-1 do
begin
StringGrid1.Cells[c,r] := Format('cell %d', [x]);
Inc(x);
end;
StringGrid1.Row:= StringGrid1.RowCount-1; end;
procedure TForm1.btnDeleteRowClick(Sender: TObject);
begin
if StringGrid1.Row > StringGrid1.FixedRows then
StringGrid1.DeleteRow(StringGrid1.Row)
else
StringGrid1.Rows[1].Text := '';
end;
...