在frmmain 的onshow 中
 frmsplash:=TfrmSplash.create(Self);
 show;
 做些事情(比如打开数据库)
 frmsplash.update;
 Frmsplash.free; 
当然要放imagebox在frmsplash中

解决方案 »

  1.   

    先建立一个新的form,将其borderstyle设为bsnone,在form上放一个timage控件,装载图片,将timage控件的align属性设为alclient。
    在主程序的project中添加如下代码:
      uses
        unit2 in 'unit2.pas'
      {$R *.res}
      begin
        form2:=Tform2.create(form2); //创建启动画面窗口
        form2.show;  //显示
        form2.update;
        sleep(1000);  //启动画面显示时间
        form2.hide;  //隐藏
        form2.free;  //释放
    运行
      

  2.   

    在frmmain 的onshow 中
    frmsplash:=TfrmSplash.create(Self);
    show;
    做些事情(比如打开数据库)
    frmsplash.update;
    Frmsplash.free; 
    当然要放imagebox在frmsplash中 上面可实现DELPHI启动时的画面的大部分,但是要注意的是TfrmSplash的borderstyle应该是bsnone,否则会有标题栏和系统菜单
      

  3.   

    如果你需要的时间长,可以在主程序的oncreate事件中加一段消耗时间的代码。如:
    for i:=1 to 10000 do ……
      

  4.   

    program Splash;uses
      Forms,
      Main in 'Main.pas' {MainForm},
      WnSplashForm in 'WnSplashForm.pas' {SplashForm};//启动画面{$R *.res}begin
      Application.Initialize;
      SplashForm := TSplashForm.Create(Application);
      SplashForm.Show;
      SplashForm.Update;
      while SplashForm.tmmainTimer.Enabled do//延迟作用
      Application.ProcessMessages;
      Application.CreateForm(TMainForm, MainForm);
    //这里加载其他的子窗体
      SplashForm.Hide;
      SplashForm.Free;
      Application.Run;
    end.在Delphi启动快捷方式里加入 ‘-ns’‘-np’会是什么效果呢
    ‘-ns’是不显示启动画面‘-np’是不建立一个new的form
    ‘-ns’是不显示启动画面代码如下
    program Splash;uses
      Forms,
      dialogs,sysutils,
      Main in 'Main.pas' {MainForm},
      WnSplashForm in 'WnSplashForm.pas' {SplashForm};{$R *.res}begin
      Application.Initialize;
      if uppercase(paramstr(1)) <> uppercase('-ns') then
      begin
        SplashForm := TSplashForm.Create(Application);
        SplashForm.Show;  //显示 封面
        SplashForm.Update;//强制更新封面
        while SplashForm.tmmainTimer.Enabled do
        Application.ProcessMessages;
      end;
      Application.CreateForm(TMainForm, MainForm);
      if SplashForm <> nil then
      begin
        SplashForm.Hide;
      SplashForm.Free;
      end;
      Application.Run;
    end.