不对,不对。
你们都理解错了。
不知是什么原因,Button只显示一个边框。等ProgressBar到头就好了。
procedure TFormjihua.BitBtn4Click(Sender: TObject);
var
i,j,t : integer;
FRow : integer;
Temp_Mac : string;
begin
if HyperGrid1.Colcount>5 then
begin
Panel4.Visible := true;
FRow := HyperGrid1.RowCount-2;
Hypergrid1.enabled := false;
HyperGrid1.RowCount := HyperGrid1.RowCount+1;
try
ProgressBar1.Min := 0;
ProgressBar1.Max := (FRow*(FRow-1)) div 2;
ProgressBar1.Position := 0;
Progressbar1.Step := 1;
ProgressBar1.SendtoBack;
for i := 1 to FRow do
begin
Temp_mac := HyperGrid1.Cells[0,i];
for j := i+1 to FRow do
begin
ProgressBar1.Position :=ProgressBar1.Position+1;
if Temp_Mac > HyperGrid1.Cells[0,j] then
begin
for t := 0 to HyperGrid1.ColCount-1 do
HyperGrid1.Cells[t,HyperGrid1.Rowcount-1] := HyperGrid1.Cells[t,i];
for t := 0 to HyperGrid1.Colcount-1 do
Hypergrid1.Cells[t,i] := HyperGrid1.Cells[t,j];
for t := 0 to hyperGrid1.Colcount-1 do
HyperGrid1.Cells[t,j] := Hypergrid1.Cells[t,HyperGrid1.Rowcount-1];
Temp_mac := HyperGrid1.Cells[0,i];
end ;
end;
end;
finally
Panel4.Visible := false;
HyperGrid1.enabled := true;
Hypergrid1.DeleteRow(HyperGrid1.RowCount-1);
end;
end;
showmessage ('排序完成,共'+inttostr(HyperGrid1.Rowcount-2)+'项任务');