在初始化背景(主)窗口时避免视觉干扰



我尝试用我的自定义图像更改默认背景图像。

我使用以下代码:

procedure PrepareBackGround;
var
   BackgroundBitmapImage: TBitmapImage;
   TopLeftLabel: TLabel;
   BitmapFileName: String;
   sWidth,sHeight : integer;
begin         
   sWidth:=GetSystemMetrics(0);
   sHeight:=GetSystemMetrics(1);
   MainForm.Width := 848;
   MainForm.height := 660; 
   MainForm.top := (sHeight-MainForm.height)/2;
   MainForm.Left := (sWidth-MainForm.Width)/2; 
   BitmapFileName :=ExpandConstant('{src}SetupFilesFullScr.bmp');
   BackgroundBitmapImage := TBitmapImage.Create(MainForm);
   BackgroundBitmapImage.Bitmap.LoadFromFile(BitmapFileName);
   BackgroundBitmapImage.Parent :=MainForm;
   BackgroundBitmapImage.Align:=alCLient;
   BackgroundBitmapImage.Stretch:=True;
   TopLeftLabel := TLabel.Create(MainForm);
   TopLeftLabel.Parent := MainForm;
   TopLeftLabel.Left := 10;
   TopLeftLabel.Top := 10 ;
   TopLeftLabel.Font.Color := clBlack;
   TopLeftLabel.color := clWhite;
   TopLeftLabel.Font := WizardForm.WelcomeLabel1.Font;
   TopLeftLabel.Font.Style :=  [fsitalic,fsBold];
   TopLeftLabel.Caption := 
     'SoftwareXXX ' +
     GetIniString(
       'Version Installation', 'Installation', 'unknown',
       ExpandConstant('{src}SourcesFile.Ver'));
   TopLeftLabel.WordWrap := WizardForm.WelcomeLabel1.WordWrap;
end;
procedure InitializeWizard; 
begin
  { to display an image in background Window( see in Supportfunction.iss) }
  PrepareBackGround;
  { ... }
end;

但是当我运行它时,我看到一些照明(作为闪光灯)。灯亮的原因是新图像的负载。

我怎样才能避开这束光?如何修改或访问MainForm以修改背景图像,然后再显示?

谢谢。

我可以纠正这个错误:

[Setup]
WindowVisible=No

,我在函数

的末尾添加
procedure PrepareBackGround;
var
   //...
begin         
    //..  
   MainForm.Show;
end;

我相信你所说的"flash"是由于调整了最大化主窗口的大小。

尝试使用WindowStartMaximized指令:

[Setup]
WindowStartMaximized=no

在显示主窗口之前没有触发事件,而是在创建主窗口之后。

最新更新