list:array of integer;
begin
screen.cursor:=crhourglass;
tempgrid:=TStringgrid.create(nil);
with tempgrid do
begin
rowcount:=grid.rowcount;
colcount:=grid.colcount;
fixedrows:=grid.fixedrows;
end;
with Grid do
begin
setlength(list,rowcount-fixedrows);
for i:= fixedrows to rowcount-1 do
begin
list[i-fixedrows]:=i;
tempgrid.rows[i].assign(grid.rows[i]);
end;
quicksort(Grid, list,0,rowcount-fixedrows-1,sortcol,datatype);
for i:=0 to rowcount-fixedrows-1 do
begin
rows[i+fixedrows].assign(tempgrid.rows[list[i]])
end;
row:=fixedrows;
end;
tempgrid.free;
setlength(list,0);
延伸阅读
文章来源于领测软件测试网 https://www.ltesting.net/