VCL里面的的实现
program ZhouFamily; uses Vcl.Forms, Winapi.Windows, FrmZhouFamilyMainU in 'FrmZhouFamilyMainU.pas' {FrmZhouFamilyMain} , SplashFormU in 'SplashFormU.pas' {SplashForm} , DmU in 'DmU.pas' {DM: TDataModule}; var Timestart, timeend: dword; begin Application.Initialize; Application.MainFormOnTaskbar := True; SplashForm := TSplashForm.Create(Application); SplashForm.Show; SplashForm.Update; Timestart := gettickcount; Application.CreateForm(TDM, DM); // 数据模块加载 Application.CreateForm(TFrmZhouFamilyMain, FrmZhouFamilyMain); // 主窗口加载 timeend := gettickcount; if timeend - Timestart < 1000 then begin sleep(1000 - (timeend - Timestart)); end; SplashForm.Hide; SplashForm.Free; Application.Run; end.
FMX里面的实现,很不完美,只是为了闪屏而闪屏,因为form的create 事件是在 Application.Run;后才执行的,如果哪位兄弟有好的改进版本,期待能通知下我!
program ZhouFamily; uses FMX.Forms, System.SysUtils, FrmZhouFamilyMainU in 'FrmZhouFamilyMainU.pas' {FrmZhouFamilyMain} , SplashFormU in 'SplashFormU.pas' {SplashForm} , DmU in 'DmU.pas' {DM: TDataModule}; {$R *.res} var Timestart, timeend: Tdatetime; begin Application.Initialize; SplashForm := TSplashForm.Create(nil); Timestart := gettime; Application.ProcessMessages; Application.CreateForm(TDM, DM); Application.CreateForm(TFrmZhouFamilyMain, FrmZhouFamilyMain); Application.ProcessMessages; timeend := gettime; if timeend - Timestart < 1000 then begin sleep(1000 - trunc(timeend - Timestart)); end; SplashForm.Hide; SplashForm.Free; Application.Run; end.