图片覆盖了Inno Setup中的整个页面 [英] Image covering whole page in Inno Setup

查看:90
本文介绍了图片覆盖了Inno Setup中的整个页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

此后: Inno设置将图像/控件放在自定义中页面.

这是我所需要的:

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;

但是,我希望背景图像在标题下方且在页脚上方且没有侧边距的情况下,是空格的完整大小.我尝试了各种拉伸/边距/高度/宽度,但结果很混乱.无论DPI怎样,看起来最好的最佳方法是什么?

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?

推荐答案

您可以使用

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

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

尽管您会看到(自定义)页面没有覆盖页眉"(MainPanel)和页脚"(带按钮的底部)之间的整个区域.

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

如果要在页眉"和页脚"之间的整个区域显示图像,则不能将其放置在(自定义)页面上.您必须将其放置在InnerPage(所有带有页眉"的页面的父控件)上.

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;

但是那样,在自定义页面显示/隐藏时,图像将不会自动显示/隐藏.您必须对其进行编码.使用 CurPageChanged事件函数.

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;

类似的问题:

  • 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.

这篇关于图片覆盖了Inno Setup中的整个页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆