Inno Setup - 将自定义按钮与取消按钮对齐
Inno Setup - aligning custom button with the Cancel button
当我在 Setup
部分使用 WizardSizePercent = 150
时,我无法将按钮设置为与 Cancel 按钮相同的顶部大小。
这是我的代码:
AboutButton := TNewButton.Create(WizardForm);
AboutButton.Parent := WizardForm;
AboutButton.Left := WizardForm.CancelButton.Left;
AboutButton.Top := WizardForm.CancelButton.Top;
AboutButton.Width := WizardForm.CancelButton.Width;
AboutButton.Height := WizardForm.CancelButton.Height;
我认为 Inno Setup 没有注意到 WizardSizePercent
,因为它只使用常规 WizardForm
大小。
我假设您的代码在 InitializeWizard
. That event function occurs before WizardSizePercent
is applied. If you want your button to correctly align when the wizard window changes size, either due to WizardSizePercent
or WizardResizable
中,您需要遵循他们的文档:
Use Anchors
and KeepSizeY
properties 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.
特别是:
AboutButton.Anchors := WizardForm.CancelButton.Anchors;
CancelButton.Anchors
是 [akRight, akBottom]
。如果您的 “关于” 按钮应该是 left-aligned,请使用:
AboutButton.Anchors := [akLeft, akBottom];
相关问题:
当我在 Setup
部分使用 WizardSizePercent = 150
时,我无法将按钮设置为与 Cancel 按钮相同的顶部大小。
这是我的代码:
AboutButton := TNewButton.Create(WizardForm);
AboutButton.Parent := WizardForm;
AboutButton.Left := WizardForm.CancelButton.Left;
AboutButton.Top := WizardForm.CancelButton.Top;
AboutButton.Width := WizardForm.CancelButton.Width;
AboutButton.Height := WizardForm.CancelButton.Height;
我认为 Inno Setup 没有注意到 WizardSizePercent
,因为它只使用常规 WizardForm
大小。
我假设您的代码在 InitializeWizard
. That event function occurs before WizardSizePercent
is applied. If you want your button to correctly align when the wizard window changes size, either due to WizardSizePercent
or WizardResizable
中,您需要遵循他们的文档:
Use
Anchors
andKeepSizeY
properties to add full support forWizardResizable
andWizardSizePercent
to all your custom controls, custom wizard pages andTSetupForm
forms if you have any. See the CodeClasses.iss example script for an example.
特别是:
AboutButton.Anchors := WizardForm.CancelButton.Anchors;
CancelButton.Anchors
是 [akRight, akBottom]
。如果您的 “关于” 按钮应该是 left-aligned,请使用:
AboutButton.Anchors := [akLeft, akBottom];
相关问题: