10

Inno Setup 设置向导的大小是固定的,但我想更改向导设置大小并更改一些项目,包括图像和...

在此处输入图像描述

4

3 回答 3

13

创新设置 6

Inno Setup 6 支持更改向导窗口的大小。

您可以使用WizardSizePercent来更改向导窗口的大小。

您还可以使用WizardResizable允许用户调整向导的大小(这是默认行为,如果您使用modern WizardStyle)。

创新设置 5

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

以下代码只是一个示例,您可能希望选择另一种布局更改。

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;

该代码负责以下页面:

  • 欢迎页面

    欢迎页面

  • 许可页面

    许可页面

  • 选择目录页

    选择目录页

  • 选择组件页面

    选择组件页面

  • 选择任务页面

    选择任务页面

  • 就绪页面

    就绪页面

  • 安装页面

    安装页面

  • 完成页

    完成页


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

  • 密码页
  • InfoBeforePage(与 LicensePage 相同)
  • 用户信息页
  • 选择程序组页面
  • 准备页面
  • InfoAfterPage(与 LicensePage 相同)

类似的问题:

于 2017-05-25T12:38:27.347 回答
1

我正在用最新的答案更新这个问题:

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.

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

于 2019-05-07T03:59:10.370 回答
0

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

它具有您所要求的所有灵活性,以及​​更多:

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

到目前为止,我遇到的 NSIS 的唯一缺点是:

  • 它的脚本语言有点特别,需要一些初步学习才能习惯。
于 2020-06-21T07:33:04.397 回答