Application.CreateForm(TfmPictureShow,fmPictureShow); //启动窗体 fmPictureShow.Show; fmPictureShow.Repaint; fmPictureShow.ProgressBar.StepBy(25); OpenTable(); procedure OpenTable(); var i,j,itmp:integer; strPriv:string; begin itmp := 0; for i := 0 to dm.ComponentCount - 1 do begin if (dm.Components[i] is TDataSet) then itmp := itmp+1; end; fmPictureShow.ProgressBar.StepBy(25); for i := 0 to dm1.ComponentCount - 1 do begin if (dm1.Components[i] is TDataSet) then itmp := itmp+1; end; TblDealer.open; TblContact.Open; ..... fmPictureShow.ProgressBar.StepBy(25); fmPictureShow.ProgressBar.Step := 900 div itmp; for i := 0 to ComponentCount - 1 do begin if (Components[i] is TDataSet) then begin try fmPictureShow.ProgressBar.StepIt; (Components[i] as TDataSet).open; except WriteIniFile('Error' , inttostr(i) , Components[i].Name); end; end; end; end;
随便找了一个。。
frmSplash:=TfrmSplash.create(nil);
frmwait.show;
Application.ProcessMessages;
//你的加载语句
frmwait.close;
fmPictureShow.Show;
fmPictureShow.Repaint;
fmPictureShow.ProgressBar.StepBy(25);
OpenTable(); procedure OpenTable();
var
i,j,itmp:integer;
strPriv:string;
begin
itmp := 0;
for i := 0 to dm.ComponentCount - 1 do
begin
if (dm.Components[i] is TDataSet) then
itmp := itmp+1;
end; fmPictureShow.ProgressBar.StepBy(25); for i := 0 to dm1.ComponentCount - 1 do
begin
if (dm1.Components[i] is TDataSet) then
itmp := itmp+1;
end; TblDealer.open;
TblContact.Open;
.....
fmPictureShow.ProgressBar.StepBy(25);
fmPictureShow.ProgressBar.Step := 900 div itmp;
for i := 0 to ComponentCount - 1 do
begin
if (Components[i] is TDataSet) then
begin
try
fmPictureShow.ProgressBar.StepIt;
(Components[i] as TDataSet).open;
except
WriteIniFile('Error' , inttostr(i) , Components[i].Name);
end;
end;
end;
end;