关于无法关闭欢迎界面的问题(50分)

  • 主题发起人 北回归线
  • 开始时间

北回归线

Unregistered / Unconfirmed
GUEST, unregistred user!
我做了一个欢迎界面,主要是在窗体上带图象,并用timer控制十秒后,启动第2个窗体,
并关闭欢迎界面。但是不是出现无法关闭欢迎界面就是出现关闭欢迎界面,同时关闭第二窗体
。希望大家帮我一下。指导我具体怎么做。最好是源代码。谢谢
 
欢迎界面自动创建,10秒后动态建立第二个窗体,在第二个窗体的ONACTIVE里关闭
欢迎界面应该就可以了
 
用tsplasform 就可以了
 
创建闪现窗口:
在project文件中:
Application.Initialize;
f_flash := Tf_flash.create(Application);
f_flash.show;
f_flash.update;
。。。。。
f_flash.close;
Application.Run
 
欢迎窗体代码:
unit Unit1;

interface

uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ExtCtrls;

type
TForm1 = class(TForm)
Image1: TImage;
Timer1: TTimer;
procedure FormCreate(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;
i:integer=0;

implementation

uses Unit2;

{$R *.DFM}

procedure TForm1.FormCreate(Sender: TObject);
begin
timer1.Enabled:=true;
end;

procedure TForm1.Timer1Timer(Sender: TObject);
begin
if i<9 then
i:=i+1
else
begin
with tform2.Create(nil)do
begin
try
showmodal;
finally
free;
end;
end;
end;
end;

第二个窗体需要的代码:
procedure TForm2.FormActivate(Sender: TObject);
begin
form1.Timer1.Enabled:=false;
form1.Hide;
end;
 
程序运行前显示LOGO窗体

在DPR工程文件中:修改

begin
logoform := TLogoform.Create(nil);
try
logoform.Show;{ NOTE! show! NOT showmodal }
logoform.Update;
// 这儿建立主窗口,诸如Application.CreateForm()等函数
finally
logoform.Hide;
logoform.Release;
logoform.free;
end;
Application.Run;
end;

可在主窗口的OnCreate事件中控制LOGO窗口的延时时间,以下例程延时3秒。

program TMainForm.FormCreate(sender:Tobject);
var
currentTime:LongInt;
begin
currentTime:=GetTickCount div 1000;
while ((GetTickCount div 1000)<(currentTime+3)
do {不做任何事);
end;

 
闪现窗口与第二个窗口均用Application来建立。
 
欢迎窗口不能设成mainform
 
多人接受答案了。
 
顶部