启动窗体问题(50分)

  • 主题发起人 主题发起人 wohoot
  • 开始时间 开始时间
W

wohoot

Unregistered / Unconfirmed
GUEST, unregistred user!
源码:
program Project1;
uses
Forms,dateutils,SysUtils,
main in 'main.pas' {Fmain},
page1 in 'page1.pas' {Fpage1};
{$R *.res}
var
time1:TDateTime;
begin
Fpage1:=Tfpage1.Create(Application);
Fpage1.Show;//page1为启动窗体
Fpage1.Refresh;
time1:=NOW;
repeat
until time1+time1+time1+5/24*60*60<=now;//延时5秒
Application.Initialize;
Application.CreateForm(TFmain, Fmain);
Application.Run;
end.



unit main;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls,page1;
type
TFmain = class(TForm)
Button1: TButton;
Button2: TButton;
Button3: TButton;
Button4: TButton;
Button5: TButton;
procedure FormShow(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Fmain: TFmain;
implementation
{$R *.dfm}
procedure TFmain.FormShow(Sender: TObject);
begin
Fpage1.Free;
end;
end.

问题:要求启动窗体延时5秒。但编译时不能完成,没有错误提示,只能强行结束,请教高手该怎么样修改?
 
FormCreate事件里Sleep(5000)
 
不行啊 提示 sleep错误
 
把工程里的修改为下列就OK了。
begin
Fpage1:=Tfpage1.Create(Application);
Fpage1.Show;//page1为启动窗体
Sleep(5000);
Application.Initialize;
Application.CreateForm(TFmain, Fmain);
Application.Run;
end.
 
谢谢 问题是启动窗体不消失啊?
 
按 bbscom 的方法改就好了!启动窗体就会多停留5秒的~
 
谢谢 启动问题解决,可是启动窗体怎么是空白啊?
 
program Project1;
uses
Forms,dateutils,SysUtils,
main in 'main.pas' {Fmain},
page1 in 'page1.pas' {Fpage1};
{$R *.res}
begin
Fpage1:=Tfpage1.Create(Application);
Fpage1.Show;//page1为启动窗体
Sleep(5000);
Application.Initialize;
Application.CreateForm(TFmain, Fmain);
Application.Run;
end.

我启动一切正常。
QQ:136293586
 
在fpage1上放个图片,border设成bsnone,然后如下,注释里的语句可使窗体逐渐消失。
begin
Application.Initialize;
Fpage1:=Tfpage1.Create(Application);
Fpage1.Show;//page1为启动窗体
fpage1.update;
Sleep(5000);
//fpage1.AlphaBlend := true;
//while fpage1.AlphaBlendValue >20do
// fpage1.AlphaBlendValue := fpage1.AlphaBlendValue - 6;
fpage1.free;
Application.CreateForm(TFmain, Fmain);
Application.Run;
end.
 
谢谢bbscom,yxyxyxyx,2位的指点,再请教怎么出现启动画面的时间要很久啊?
 
多人接受答案了。
 
后退
顶部