初始化背景(主)窗口时避免使用视觉瑕疵

时间:2016-10-25 13:33:55

标签: inno-setup

我尝试按自定义图片更改默认背景图片。

我使用此代码:

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}\SetupFiles\FullScr.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}\Sources\File.Ver'));
   TopLeftLabel.WordWrap := WizardForm.WelcomeLabel1.WordWrap;
end;

procedure InitializeWizard; 
begin
  { to display an image in background Window( see in Supportfunction.iss) }
  PrepareBackGround;
  { ... }
end;

但是当我跑步时,我看到一些灯光(闪光灯)。光的原因是新图像的负荷。

我怎能避免这种光?如何修改或访问MainForm以在显示背景图像之前对其进行修改?

感谢。

2 个答案:

答案 0 :(得分:1)

我可以通过以下方式纠正这个错误:

[Setup]
WindowVisible=No

我在我的功能中添加

procedure PrepareBackGround;
var
   //...
begin         
    //..  
   MainForm.Show;
end;

答案 1 :(得分:0)

我相信你所指的“闪光”是由于最大化主窗口的调整大小。

尝试使用WindowStartMaximized directive

[Setup]
WindowStartMaximized=no

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