Delphi启动屏幕-未绘制Timage和Tlabel
我正在尝试向Delphi7程序添加一个启动屏幕。我在中使用了这个例子,只是我没有3秒的最小值。一旦主窗体加载并准备就绪,我希望splash关闭 splash表单包含一个在设计时静态加载BMP的Timage和一个Tlabel。表单在IDE中看起来是正确的 运行程序时,会显示启动屏幕窗口的背景,但不会显示Timage或Tlabel。它只是一个带有表单背景颜色的空矩形。当主窗口显示时,它将正确地消失。 我错过了什么 这是program.dpr中的启动代码:Delphi启动屏幕-未绘制Timage和Tlabel,image,delphi-7,splash-screen,Image,Delphi 7,Splash Screen,我正在尝试向Delphi7程序添加一个启动屏幕。我在中使用了这个例子,只是我没有3秒的最小值。一旦主窗体加载并准备就绪,我希望splash关闭 splash表单包含一个在设计时静态加载BMP的Timage和一个Tlabel。表单在IDE中看起来是正确的 运行程序时,会显示启动屏幕窗口的背景,但不会显示Timage或Tlabel。它只是一个带有表单背景颜色的空矩形。当主窗口显示时,它将正确地消失。 我错过了什么 这是program.dpr中的启动代码: Application.Initiali
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.
我找到了解决办法。我不确定这是否是最好的解决方案,但它确实有效。 我把 在DPR文件中
FormSplash.Show;
FormSplash.Show;