启动画面,登录窗口,在主窗口的Create事件中实现的话,关闭登录窗口,进入主Form,但此时后续的autocreate窗口的create事件开始执行,所以过了很久,主界面才显示完成。
能否这样:启动画面,登录窗口,登录正确后,代码create某些Form(也就是原先autoCreate的Form),全部Form的Create事件完成后,关闭启动画面,显示主Form

解决方案 »

  1.   


      try
        frmFlash.Show;
        frmFlash.Update;
        Application.CreateForm(TfrmDM, frmDM);//以及其他窗体
      finally
        frmFlash.Free;
      end;
      

  2.   


    begin  Application.Initialize;
      Application.Title := 'eConnexion';  frmSplash := TfrmSplash.Create(Nil);
      try
        frmSplash.Show;
        Application.ProcessMessages;
        frmSplash.Close;
      finally
        if Assigned(frmSplash) then
          FreeAndNil(frmSplash);
      end;  Application.CreateForm(TfrmMainCustom, frmMainCustom);
      Application.CreateForm(TfrmOrderEntryCustom, frmOrderEntryCustom);
      Application.Run;
    end.
      

  3.   

    begin
      Application.Initialize;
      Application.Title := 'eConnexion';
      frmSplash := TfrmSplash.Create(Nil);
      try
        frmSplash.Show;
        Application.CreateForm(TfrmMainCustom, frmMainCustom);
        Application.CreateForm(TfrmOrderEntryCustom, frmOrderEntryCustom);
      finally
        FreeAndNil(frmSplash);
      end;
      Application.Run;
    end.
    一般耗时的操作在
        Application.CreateForm(TfrmMainCustom, frmMainCustom);
        Application.CreateForm(TfrmOrderEntryCustom, frmOrderEntryCustom);
    之中,所以在他们之前显示frmSplash.Show;如果窗体有时会显示不完全,请在Show之后加上Application.ProcessMessages;
    然后在主窗体创建好之后,释放起始窗体,直到Application.Run;才会调用frmMainCustom.Show;具体可参考源代码
      

  4.   

    登录失败退出程序,用close吧?
      

  5.   

    楼上已经帮你说明了,只是没有那么明显而已,应该在主程序里。
    进入主程序可以通过 Project->View Source
      

  6.   

    发现了一个问题,application.create主窗口语句,会显示主窗口,然后再依次执行后面的application.create语句。
    如果把登录窗口放在主窗口的FormCreate事件中,即时登录失败,application.terminate,后面的auto窗口也会执行,过来一会才关闭系统。
      

  7.   

    在所有执行前.View Source