将 Inno Setup MainPanel 调整为横幅图像大小

Adjust Inno Setup MainPanel to banner image size

不允许我调整用于 MainPanel 的图像的大小。这导致了问题,因为它覆盖了我创建的输入查询页面。如何确保输入查询页面“增长”的尺寸由 MainPanel 图像设置?

procedure InitializeWizard;
begin
  { Extract the banner so we can use it with the input page. }
  BannerImage := TBitmapImage.Create(WizardForm);
  BannerImage.Bitmap.LoadFromFile('C:\temp\tempbanner.bmp');
  { Create the Bitmap Banner img to show on the Main Panel. }
  BannerImage.Parent := WizardForm.MainPanel;
  WizardForm.MainPanel.Width := SPLASH_SCREEN_WIDTH;
  WizardForm.MainPanel.Height := BANNER_HEIGHT; 
  BannerImage.Width := WizardForm.MainPanel.Width;
  BannerImage.Height := WizardForm.MainPanel.Height;
  { BannerImage.Anchors := [akLeft, akTop, akRight, akBottom]; }
  BannerImage.Stretch := False;
  BannerImage.AutoSize := False;
  
  WizardForm.WizardSmallBitmapImage.Visible := False;
  WizardForm.PageDescriptionLabel.Visible := False;
  WizardForm.PageNameLabel.Visible := False;
  
  { Create the input page }
  ReportingServerPage := CreateInputQueryPage(wpWelcome,
  'Title', 'What is your XXX?',
  'Please enter your Server URL, then click Next.'+#13#10+#13#10+'If you proceed without entering a URL, you can update it in the %AppData%\xxxxxxxx\xxxx\xxxxx\xxxx_launcher.properties file at a later stage.');
  ReportingServerPageId := ReportingServerPage.ID;
  {  Add items (False means it's not a password edit) }
  ReportingServerPage.Add('&Reporting Server URL:', False);

end;

您必须增加 window 高度并将 window 内容(Bevel1InnerNotebook)向下移动。

请注意,底部对齐的控件(底部按钮)会随着 window 高度的增加而自动移动(假设您使用最新版本的 Inno Setup)。

[Files]
Source: "banner.bmp"; Flags: dontcopy

[Code]

var
  ReportingServerPage: TInputQueryWizardPage;

procedure InitializeWizard;
var
  BannerImage: TBitmapImage;
  Delta: Integer;
begin
  BannerImage := TBitmapImage.Create(WizardForm);
  ExtractTemporaryFile('banner.bmp');
  BannerImage.AutoSize := True;
  BannerImage.Bitmap.LoadFromFile(ExpandConstant('{tmp}\banner.bmp'));
  BannerImage.Parent := WizardForm.InnerPage;
  BannerImage.Left := 0;
  BannerImage.Top := 0;

  Delta := BannerImage.Height - WizardForm.Bevel1.Top;
  WizardForm.Height := WizardForm.Height + Delta;
  WizardForm.Bevel1.Top := WizardForm.Bevel1.Top + Delta;
  WizardForm.InnerNotebook.Top := WizardForm.InnerNotebook.Top + Delta;
  WizardForm.InnerNotebook.Height := WizardForm.InnerNotebook.Height - Delta;

  WizardForm.MainPanel.Visible := False;
  
  { Create the input page }
  ReportingServerPage := CreateInputQueryPage(wpWelcome,
    'Title', 'What is your XXX?',
    'Please enter your Server URL, then click Next.'+#13#10+#13#10+
    'If you proceed without entering a URL, you can update it in the ' + 
    '%AppData%\xxxxxxxx\xxxx\xxxxx\xxxx_launcher.properties file at a later stage.');
  {  Add items (False means it's not a password edit) }
  ReportingServerPage.Add('&Reporting Server URL:', False);
end;

请注意,代码不适合 image/window 宽度。它假定图像宽度适合 window 宽度。