如何显示此初始屏幕3秒钟? [英] How to show this splash screen for 3 seconds?
本文介绍了如何显示此初始屏幕3秒钟?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用此处提到的方法创建了初始屏幕: http:// delphi.about.com/od/formsdialogs/a/splashscreen.htm
I created my splash screen using the method mentioned here: http://delphi.about.com/od/formsdialogs/a/splashscreen.htm
在显示主表单之前,我需要显示启动屏幕3秒钟。
I need to show the splash screen for 3 seconds before showing the main form.
请帮助。谢谢。
推荐答案
内部项目文件:
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秒或更长时间。创建您应用程序的所有形式。
The splash screen will be visible for minimum time of 3 seconds or more if it will take more time to create all the forms of your application.
这篇关于如何显示此初始屏幕3秒钟?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文