var i:integer; begin progressbar1:=Tprogressbar1.create(self); try progressbar1.parent:=self; progressbar1.min=0; progressbar1.max:=Total;//自己設置 progressbar1.step:=StepQ://設置重復次數 For i:=1 to Total do progressbar1.Stepit; showmessage('success!'); Finally progressbar1.Free; End; End;
i:integer;
begin
progressbar1:=Tprogressbar1.create(self);
try
progressbar1.parent:=self;
progressbar1.min=0;
progressbar1.max:=Total;//自己設置
progressbar1.step:=StepQ://設置重復次數
For i:=1 to Total do progressbar1.Stepit;
showmessage('success!');
Finally
progressbar1.Free;
End;
End;
http://expert.csdn.net/Expert/topic/1299/1299906.xml?temp=.8919947
他说明了如何在查询时调用进度条呀。
那么在你的循环中不就好做了吗?
只是在设三个值,你明白了吗?
eoAsyncFethchNonBlacking:异步数据模式.适合大记录.这里把上面哪个设置为true都可以的.
procedure TForm1.Button1Click(Sender: TObject);
begin
ADOQuery1.Close;
ADOQuery1.SQL.Clear;
ADOQuery1.SQL.Add('select * from tablename');
ADOQuery1.Open;
end;procedure TForm1.ADOQuery1FetchProgress(DataSet: TCustomADODataSet;
Progress, MaxProgress: Integer; var EventStatus: TEventStatus);
begin
ProgressBar1.Position := Progress*100 div maxProgress;
Application.ProcessMessages;
end;