Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Image covering whole page in Inno Setup

Following on from this: Inno Setup Placing image/control on custom page.

This is doing what I need:

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;

However I would like the background image to be the full size of the space bellow the heading and above the footer with no side margins. I was trying various stretch/margin/height/width, but the results are messy. What's the best way to achieve this that looks good no matter the DPI?

like image 999
778899 Avatar asked Jan 24 '26 14:01

778899


1 Answers

You can retrieve a size of the (custom) page surface using TWizardPage.SurfaceHeight and TWizardPage.SurfaceWidth.

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

Though you will see that the (custom) page does not cover whole area between "header" (MainPanel) and "footer" (bottom part with buttons).

enter image description here


If you want to display image across the whole area between "header" and "footer", you cannot place it on the (custom) page. You have to place it on the InnerPage (what is a parent control of all pages with the "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];

But that way the image won't get automatically shown/hidden as the custom page shows/hides. You have to code it. Use CurPageChanged event function.

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

enter image description here


Similar questions:

  • An alternative implementation that resizes the "pages" to cover whole upper parts of the wizard window:
    Can you create a custom page that looks like the Finish page?
  • Displaying an image even over the "header":
    How to hide the main panel and show an image over the whole page?
  • Displaying an image as a background of whole window: Inno Setup - Image as installer background.
like image 181
Martin Prikryl Avatar answered Jan 26 '26 11:01

Martin Prikryl



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!