如何在Inno Setup安装程序中更改向导大小(宽度和高度)?

时间:2012-08-02 13:19:56

标签: inno-setup

Inno Setup设置向导大小已修复,但我想更改向导设置大小并更改一些项目,包括图像和...

enter image description here

4 个答案:

答案 0 :(得分:6)

没有神奇的方法可以让向导页面更大。它们专为特定尺寸设计。如果你想让它们变大,你必须逐页控制,逐个控制并仔细决定如何为新尺寸布局它们。

以下代码只是一个示例,您可能希望在布局中选择其他更改。

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

    LicensePage

  • SelectDirPage

    SelectDirPage

  • SelectComponentsPage

    SelectComponentsPage

  • SelectTasksPage

    SelectTasksPage

  • ReadyPage

    ReadyPage

  • InstallingPage

    InstallingPage

  • FinishedPage

    FinishedPage

其他不常见的页面留给读者练习:

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

类似的问题:

答案 1 :(得分:0)

我正在使用最新答案更新此问题:

Inno Setup 6引入了许多更改,其中之一是可以调整向导窗口的大小,它现在是Inno Setup的标准功能:

可调整大小的向导窗口

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

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.

现在,无需任何特殊的技巧或代码即可轻松调整向导窗口的大小。

答案 2 :(得分:-1)

我强烈建议使用NSIS而不是InnoSetup来创建Windows安装程序。 NSIS创建技术上更好的安装程序(没有临时文件和多个解压缩阶段),可以在任何方向完全编写脚本,并且可以用于在交叉编译设置中创建Windows安装程序,请参见例如Debian nsis软件包。

答案 3 :(得分:-2)

我强烈建议使用NSIS而不是InnoSetup来创建Windows安装程序。

NSIS的优点:

  • NSIS在技术上创造了更好的安装程序:没有混乱的临时文件和多个解压缩阶段。
  • 因此,创建的安装程序非常快。
  • NSIS可以在任何方向完全编写脚本,我能够实现所需的安装程序的所有自定义。
  • NSIS可用于在交叉编译设置中创建Windows安装程序,请参见例如Debian nsis package
  • 也就是说,您可以创建一个非常好的Windows安装程序,而无需接触Windows系统。这就是为什么它也成为Windows交叉编译工具链MXE的一部分的原因。

NSIS的缺点:

  • 它的脚本语言是临时的,需要一些初步的学习来习惯。