程序启动要做初始化,一般花费较长时间的,必须有个闪屏等待画面, 但要是程序一开始就创建出来的话, 就不能把它close掉,否则整个程序就结束了, 有什么好的处理流程?
我最后用个大的Panel放在主程序上面,Panel上有个闪屏等待画面, 初始化结束后,Panel在隐藏,主程序界面显示。感觉很土。 各位是怎么做的??

解决方案 »

  1.   

    在Application.Initialize;
      Application.CreateForm(TForm1, Form1);
      Application.ShowMainForm:=False;
      Application.Run;
    这里加上就搞定了
      

  2.   

    var StartForm:TForm1;//这个就是启动窗口
    begin
      StartForm:=TForm1.Create(nil);
      StartForm.Show;
      StartForm.Update;
      Application.Initialize;
      Application.Title := '接入网设备监控程序';
      Application.CreateForm(TfrmMain, frmMain);
      StartForm.Close;
      Application.Run;
    end.
    ///////////////////////这样就可以了
      

  3.   

    begin
      Application.Initialize;  frmStart := TfrmStart.Create(nil);
      frmStart.Show;
      frmStart.Update;
      frmStart.timer.Enabled := true;
      
      Application.CreateForm(TfrmMain, frmMain);
      Application.CreateForm(TfrmVideo, frmVideo);
      Application.CreateForm(TfrmText, frmText);
      Application.CreateForm(TFrmLessonList, FrmLessonList);
      Application.CreateForm(TfrmListen, frmListen);
      Application.CreateForm(TfrmIndex, frmIndex);
      Application.CreateForm(TfrmDefineWord, frmDefineWord);
      repeat
        Application.ProcessMessages;
      until not frmStart.timer.Enabled;
      frmStart.Close;  Application.Run;
    end.//启动画面需要设定一个Timer用来控制启动画面驻留的时间,另外启动画面窗口//不要加到 Auto Create 的窗口列表中
    type
      TfrmStart = class(TForm)
        timer: TTimer;
        imgStart: TImage;
        procedure timerTimer(Sender: TObject);
        procedure FormCreate(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;var
      frmStart: TfrmStart;implementation{$R *.dfm}procedure TfrmStart.timerTimer(Sender: TObject);
    begin
      timer.Enabled := false;
    //  Close;end;procedure TfrmStart.FormCreate(Sender: TObject);
    begin
      Timer.Enabled := true;
    end;
      

  4.   

    Application.Initialize;
      Application.Title := '质量安全信息查询系统--后台维护';
      Application.CreateForm(TfrmMain, frmMain);
      Application.CreateForm(TfrmTop, frmTop);
      Application.CreateForm(Tdm, dm);
      Application.CreateForm(TLogonFrm, LogonFrm);
      Application.CreateForm(TfrmUserManagement, frmUserManagement);
      Application.CreateForm(TfrmPartManagement, frmPartManagement);
      Application.CreateForm(TfrmCatalog, frmCatalog);
      Application.CreateForm(TfrmArticle, frmArticle);
      Application.CreateForm(TfrmHtmlPreview, frmHtmlPreview);
      Application.CreateForm(Tfrm_print, frm_print);
      Application.CreateForm(TfrmQSCorporationCatalog, frmQSCorporationCatalog);
      Application.CreateForm(TfrmQSProductType, frmQSProductType);
      frmtop.Show;
      Application.ProcessMessages;  frmtop.Update;
      Sleep(2000); //延时
      LogonFrm.ShowModal;
      frmtop.Hide;
      frmtop.Free; //释放启动封面
      Application.Run;
      

  5.   

    初始化结束后,Panel在隐藏,主程序界面显示。
    如是这样的话,那个panel总是在后台运行着,显然浪费内存和cpu啦,
    不行的