0
我想添加啓動畫面到Delphi 7程序。我使用this post中的示例,但我沒有3秒的最小值。一旦主表單被加載並準備就緒,我想要關閉飛濺。德爾福啓動畫面 - Timage和Tlabel未被繪製
飛濺形式包含一個Timage(在設計時靜態加載一個BMP)和一個Tlabel。該窗體在IDE中看起來正確。
運行該程序時,會顯示啓動畫面窗口的背景,但Timage或Tlabel不會顯示在背景上。它只是一個帶有窗體背景顏色的空矩形。當主窗口顯示時它正確消失。 我錯過了什麼?
這是program.dpr啓動代碼:
Application.Initialize;
FormSplash := TFormSplash.Create(nil);
try
FormSplash.Show;
// Create application forms here
Application.Title := 'Sysex Filer';
Application.CreateForm(TForm1, Form1);
Application.CreateForm(TForm2, Form2);
Application.CreateForm(TFormKroTimbreCopy, FormKroTimbreCopy);
// remove the test for timer complete, and just hide the splash when we get here
FormSplash.Hide;
finally
FormSplash.Free;
end;
Application.Run;
end.
這是濺單位:
unit SplashUnit;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls;
type
TFormSplash = class(TForm)
Image1: TImage;
Label1: TLabel;
procedure FormShow(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
FormSplash: TFormSplash;
implementation
{$R *.dfm}
procedure TFormSplash.FormShow(Sender: TObject);
begin
OnShow := nil;
{ // comment out the timer and the completed flag
Completed := False;
Timer1.Interval := 3000; // 3s minimum time to show splash screen
Timer1.Enabled := True;
}
end;
end.