如何在Inno Setup的安装程序变更向导尺寸(宽度和高度)?(How to change wiz

2019-06-26 17:42发布

Inno Setup的安装向导的大小是固定的,但我想改变向导设置大小,改变了几个项目,包括图像和...

Answer 1:

没有什么神奇的方法,使向导页大。 它们是专为特定大小。 如果你想要做的更大,你必须去页逐页,控制通过控制和慎重决定如何布局他们为新的大小。

下面的代码只是一个例子,你可能想选择布局的另一个变化。

procedure ShiftDown(Control: TControl; DeltaY: Integer);
begin
  Control.Top := Control.Top + DeltaY;
end;

procedure ShiftRight(Control: TControl; DeltaX: Integer);
begin
  Control.Left := Control.Left + DeltaX;
end;

procedure ShiftDownAndRight(Control: TControl; DeltaX, DeltaY: Integer);
begin
  ShiftDown(Control, DeltaY);
  ShiftRight(Control, DeltaX);
end;

procedure GrowDown(Control: TControl; DeltaY: Integer);
begin
  Control.Height := Control.Height + DeltaY;
end;

procedure GrowRight(Control: TControl; DeltaX: Integer);
begin
  Control.Width := Control.Width + DeltaX;
end;

procedure GrowRightAndDown(Control: TControl; DeltaX, DeltaY: Integer);
begin
  GrowRight(Control, DeltaX);
  GrowDown(Control, DeltaY);
end;

procedure GrowRightAndShiftDown(Control: TControl; DeltaX, DeltaY: Integer);
begin
  GrowRight(Control, DeltaX);
  ShiftDown(Control, DeltaY);
end;

procedure GrowWizard(DeltaX, DeltaY: Integer);
begin
  GrowRightAndDown(WizardForm, DeltaX, DeltaY);

  with WizardForm do
  begin
    GrowRightAndShiftDown(Bevel, DeltaX, DeltaY);
    ShiftDownAndRight(CancelButton, DeltaX, DeltaY);
    ShiftDownAndRight(NextButton, DeltaX, DeltaY);
    ShiftDownAndRight(BackButton, DeltaX, DeltaY);
    GrowRightAndDown(OuterNotebook, DeltaX, DeltaY);
    GrowRight(BeveledLabel, DeltaX);

    { WelcomePage }
    GrowDown(WizardBitmapImage, DeltaY);
    GrowRight(WelcomeLabel2, DeltaX);
    GrowRight(WelcomeLabel1, DeltaX);

    { InnerPage }
    GrowRight(Bevel1, DeltaX);
    GrowRightAndDown(InnerNotebook, DeltaX, DeltaY);

    { LicensePage }
    ShiftDown(LicenseNotAcceptedRadio, DeltaY);
    ShiftDown(LicenseAcceptedRadio, DeltaY);
    GrowRightAndDown(LicenseMemo, DeltaX, DeltaY);
    GrowRight(LicenseLabel1, DeltaX);

    { SelectDirPage }
    GrowRightAndShiftDown(DiskSpaceLabel, DeltaX, DeltaY);
    ShiftRight(DirBrowseButton, DeltaX);
    GrowRight(DirEdit, DeltaX);
    GrowRight(SelectDirBrowseLabel, DeltaX);
    GrowRight(SelectDirLabel, DeltaX);

    { SelectComponentsPage }
    GrowRightAndShiftDown(ComponentsDiskSpaceLabel, DeltaX, DeltaY);
    GrowRightAndDown(ComponentsList, DeltaX, DeltaY);
    GrowRight(TypesCombo, DeltaX);
    GrowRight(SelectComponentsLabel, DeltaX);

    { SelectTasksPage }
    GrowRightAndDown(TasksList, DeltaX, DeltaY);
    GrowRight(SelectTasksLabel, DeltaX);

    { ReadyPage }
    GrowRightAndDown(ReadyMemo, DeltaX, DeltaY);
    GrowRight(ReadyLabel, DeltaX);

    { InstallingPage }
    GrowRight(FilenameLabel, DeltaX);
    GrowRight(StatusLabel, DeltaX);
    GrowRight(ProgressGauge, DeltaX);

    { MainPanel }
    GrowRight(MainPanel, DeltaX);
    ShiftRight(WizardSmallBitmapImage, DeltaX);
    GrowRight(PageDescriptionLabel, DeltaX);
    GrowRight(PageNameLabel, DeltaX);

    { FinishedPage }
    GrowDown(WizardBitmapImage2, DeltaY);
    GrowRight(RunList, DeltaX);
    GrowRight(FinishedLabel, DeltaX);
    GrowRight(FinishedHeadingLabel, DeltaX);
  end;
end;

使用GrowWizard从函数InitializeWizard事件功能(或其它地方),给它在宽度和高度作为参数的变化:

procedure InitializeWizard();
begin
  GrowWizard(ScaleX(100), ScaleY(80));
end;

该代码需要以下页面:

  • WelcomePage

  • LicensePage

  • SelectDirPage

  • SelectComponentsPage

  • SelectTasksPage

  • ReadyPage

  • InstallingPage

  • FinishedPage


其他不太常见的,页面被留作为练习,以飨读者:

  • PasswordPage
  • InfoBeforePage(同LicensePage)
  • UserInfoPage
  • SelectProgramGroupPage
  • PreparingPage
  • InfoAfterPage(同LicensePage)

类似的问题:

  • 如何显示在InnoSetup安装一个更大的牌照框?
  • 较大的“选择组件”页中Inno Setup的
  • 如何在InnoSetup安装程序变更向导大小(宽度和高度)?
  • Inno Setup的:调整其所有组件卸载进度形式


Answer 2:

我更新最多最新回答这个问题:

Inno Setup的6引入了许多变化,其中之一是调整向导窗口 ,也就是现在的创新安装的标准功能的可能性

可调整大小的向导窗口

向导窗口现在任选可调整大小:

Added new [Setup] section directive: WizardResizable. If this directive is set to yes, the user will be able to resize the main Setup wizard window.
Added new [Setup] section directive: WizardSizePercent, which can be used to increase the default size of all Setup and Uninstall wizard windows without increasing the font size.
Pascal Scripting changes:
    Added new Anchors property to all controls and new KeepSizeY property to TSetupForm which allows you to add full support for WizardResizable and WizardSizePercent to all your custom controls, custom wizard pages and TSetupForm forms if you have any. See the CodeClasses.iss example script for an example. This example also shows other changes done to TSetupForm.
    Added new Constraints property to the TForm support class.

新现代风格的向导

向导窗口现在支持一个更现代的外观:

Added new [Setup] section directive: WizardStyle. If this directive is set to modern, Setup and Uninstall will show a more modern look and also the defaults for WizardResizable and WizardSizePercent change to respectively yes and 120,120.
Change in default behavior: Earlier versions of Inno Setup also supported WizardStyle and if you still have WizardStyle=modern in your script (which was allowed for backward compatibility but didn't actually change anything) and don't want to new modern look, you should remove this line or change it to WizardStyle=classic.
Updated all examples and the Compiler IDE's New Script Wizard to use WizardStyle=modern.
Pascal Scripting change: Added new SurfaceColor property to the TWizardPage support class.

现在,它是很容易调整向导窗口中没有任何特殊的黑客或代码。



文章来源: How to change wizard size (width and height) in an Inno Setup installer?
标签: inno-setup