Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
421 views
in Technique[技术] by (71.8m points)

pascalscript - 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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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

BtnImage.Height := CustomPage.SurfaceHeight;
BtnImage.Width := CustomPage.SurfaceWidth;

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;

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:


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...