Inno Setup 中覆盖整个页面的图像

Image covering whole page in Inno Setup

继此:

这是我需要的:

CustomPage := CreateCustomPage(wpLicense, 'Heading', 'Sub heading.');

ExtractTemporaryFile('image.bmp');

BtnImage := TBitmapImage.Create(WizardForm);
with BtnImage do
begin
  Parent := CustomPage.Surface;
  Bitmap.LoadFromFile(ExpandConstant('{tmp}')+'\image.bmp');
  AutoSize := True;
  AutoSize := False;
  Height := ScaleX(Height);
  Width := ScaleY(Width);
  Stretch := True;
  Left := ScaleX(90);
  Top := WizardForm.SelectTasksPage.Top + WizardForm.SelectTasksPage.Height -
         Height - ScaleY(8);
  Cursor := crHand;
  OnClick := @ImageOnClick;
end;

不过,我希望背景图片是 space 标题下方和页脚上方的完整尺寸,没有边距。我尝试了各种 stretch/margin/height/width,但结果很乱。无论 DPI 如何,实现这一目标的最佳方法是什么?

您可以使用 TWizardPage.SurfaceHeight and TWizardPage.SurfaceWidth 检索(自定义)页面表面的大小。

BtnImage.Height := CustomPage.SurfaceHeight;
BtnImage.Width := CustomPage.SurfaceWidth;
// Needed for WizardStyle=modern
BtnImage.Anchors := [akLeft, akTop, akRight, akBottom];

虽然您会看到(自定义)页面没有覆盖“header”(MainPanel)和“页脚”(带按钮的底部)之间的整个区域。


如果要在“header”和“页脚”之间的整个区域显示图像,则不能将其放置在(自定义)页面上。你必须把它放在 InnerPage 上(什么是 parent 控制所有带有“header”的页面)。

BtnImage.Parent := WizardForm.InnerPage;

BtnImage.Left := 0;
BtnImage.Top := WizardForm.Bevel1.Top + 1;
BtnImage.Width := WizardForm.InnerPage.ClientWidth;
BtnImage.Height := WizardForm.InnerPage.ClientHeight - BtnImage.Top;
// Needed for WizardStyle=modern
BtnImage.Anchors := [akLeft, akTop, akRight, akBottom];

但那样一来,图像就不会自动 shown/hidden 作为自定义页面 shows/hides。您必须对其进行编码。使用 CurPageChanged event function.

procedure CurPageChanged(CurPageID: Integer);
begin
  WizardForm.InnerNoteBook.Visible := (CurPageID <> CustomPage.ID);
  BtnImage.Visible := (CurPageID = CustomPage.ID);
end;


类似问题: