delphi – 如何显示此启动画面3秒钟?
发布时间:2020-12-15 09:37:43 所属栏目:大数据 来源:网络整理
导读:我使用这里提到的方法创建了我的启动画面: http://delphi.about.com/od/formsdialogs/a/splashscreen.htm 我需要在显示主窗体之前显示启动画面3秒钟. 请帮忙.谢谢. 解决方法 内部项目文件: program Project1;uses Forms,Unit1 in 'Unit1.pas' {Form1},uSpl
我使用这里提到的方法创建了我的启动画面:
http://delphi.about.com/od/formsdialogs/a/splashscreen.htm
我需要在显示主窗体之前显示启动画面3秒钟. 请帮忙.谢谢. 解决方法
内部项目文件:
program Project1; uses Forms,Unit1 in 'Unit1.pas' {Form1},uSplashScreen in 'uSplashScreen.pas' {frmSplashScreen}; {$R *.res} begin Application.Initialize; Application.MainFormOnTaskbar := True; frmSplashScreen := TfrmSplashScreen.Create(nil); try frmSplashScreen.Show; // Create your application forms here Application.CreateForm(TForm1,Form1); while not frmSplashScreen.Completed do Application.ProcessMessages; frmSplashScreen.Hide; finally frmSplashScreen.Free; end; Application.Run; end. 内部闪屏单元: unit uSplashScreen; interface uses Windows,Messages,SysUtils,Variants,Classes,Graphics,Controls,Forms,Dialogs,ExtCtrls; type TfrmSplashScreen = class(TForm) Timer1: TTimer; procedure FormShow(Sender: TObject); procedure Timer1Timer(Sender: TObject); private { Private declarations } public Completed: Boolean; end; var frmSplashScreen: TfrmSplashScreen; implementation {$R *.dfm} procedure TfrmSplashScreen.FormShow(Sender: TObject); begin OnShow := nil; Completed := False; Timer1.Interval := 3000; // 3s minimum time to show splash screen Timer1.Enabled := True; end; procedure TfrmSplashScreen.Timer1Timer(Sender: TObject); begin Timer1.Enabled := False; Completed := True; end; end. 如果创建应用程序的所有形式需要更多时间,则启动屏幕将至少显示3秒或更长时间. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |