启动画面,登录窗口,在主窗口的Create事件中实现的话,关闭登录窗口,进入主Form,但此时后续的autocreate窗口的create事件开始执行,所以过了很久,主界面才显示完成。
能否这样:启动画面,登录窗口,登录正确后,代码create某些Form(也就是原先autoCreate的Form),全部Form的Create事件完成后,关闭启动画面,显示主Form
能否这样:启动画面,登录窗口,登录正确后,代码create某些Form(也就是原先autoCreate的Form),全部Form的Create事件完成后,关闭启动画面,显示主Form
try
frmFlash.Show;
frmFlash.Update;
Application.CreateForm(TfrmDM, frmDM);//以及其他窗体
finally
frmFlash.Free;
end;
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.
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;具体可参考源代码
进入主程序可以通过 Project->View Source
如果把登录窗口放在主窗口的FormCreate事件中,即时登录失败,application.terminate,后面的auto窗口也会执行,过来一会才关闭系统。