我之前曾问过这个问题,但我感觉没有说清楚,现叙述如下:我给应用程序做了一个splash,但运行结果是先出现一个秃秃的空form,(一闪而过后)再出现splash图画,(5秒后)再出现主程序窗口。前两者的时间间隔很短,但我确实可以看到这个间隔。注意:我那个第一次出现的form是splash的form,不是应用程序的主form!只有一次没有发生这个问题,那时我load了一副50k左右的bmp。我现在load一副100多k的jpg就有如上反应
程序有两个form,一个叫splash,一个叫form1我的splash方法是
1.引进一个form,起名splash,修改它的bordericons为空,borderstyle属性值为bs none,
2.再在窗口里放一个Image控件,align设为all client
3.image的picture属性引进一副图画,stretch设为true
4.使该form在主程序窗口之前显现,持续一段时间再消去。我在工程文件的代码中写下了这样的话
begin
Application.Initialize;
Splash:=TSplash.Create(Application);
Splash.Show;
Splash.Update; Application.CreateForm(TForm1, Form1);
Splash.Free;
Application.Run;
end;当然还有主窗体form1的延时
procedure TForm1.FormCreate(Sender: TObject);
var
CurTime:longword;
delaytime:longword;
begin
delaytime:=2000;
curtime:=gettickcount;
while(gettickcount<(curtime+delaytime))do;end;
程序有两个form,一个叫splash,一个叫form1我的splash方法是
1.引进一个form,起名splash,修改它的bordericons为空,borderstyle属性值为bs none,
2.再在窗口里放一个Image控件,align设为all client
3.image的picture属性引进一副图画,stretch设为true
4.使该form在主程序窗口之前显现,持续一段时间再消去。我在工程文件的代码中写下了这样的话
begin
Application.Initialize;
Splash:=TSplash.Create(Application);
Splash.Show;
Splash.Update; Application.CreateForm(TForm1, Form1);
Splash.Free;
Application.Run;
end;当然还有主窗体form1的延时
procedure TForm1.FormCreate(Sender: TObject);
var
CurTime:longword;
delaytime:longword;
begin
delaytime:=2000;
curtime:=gettickcount;
while(gettickcount<(curtime+delaytime))do;end;
Forms,
Graphics,
SysUtils,
ShellApi,
UMain in '..\pas\UMain.pas' {FrmMain},{$R *.res}{$R ZJM.RES}
var
bmp:Tbitmap;
begin
Application.Initialize;
bmp:=Tbitmap.Create;
Try
bmp.LoadFromFile(ExtractFilePath(ParamStr(0))+'splash.bmp');
frmsplash:=Tfrmsplash.Create(Application);
bmp.Width:=Frmsplash.Width;
bmp.Height:=frmsplash.Height;
frmsplash.Show;
frmsplash.Canvas.Draw(0,0,bmp);
finally
bmp.Free;
end;
Sleep(500);
frmsplash.Free;
Application.Title := '花型准备系统';
Application.CreateForm(TFrmMain, FrmMain);
Application.Run;
end.
Application.Initialize;
Splash:=TSplash.Create(Application);
Splash.Show;
Splash.Update;
Sleep(3000);加入
Application.CreateForm(TForm1, Form1);
Splash.Free;
Application.Run;
end;
1.应用程序执行时需要在同一个目录下找splash.bmp,如果没有的话就报错。但我想让这个图画和应用程序成为一体啊!
2.如果图片的原始尺寸大于splash窗口的尺寸,那么图片就不能完整显示。能否解答?谢谢!