这是一个标准 RTF 文档,用于LicenseFile
财产在[Setup]
Inno 设置部分:
是否可以在此页面添加一个打印按钮来触发打印许可协议?
我看到了类似的问题和答案(在 Inno Setup 的许可页面中添加“打印协议”按钮)我刚刚尝试实施。但这就是我得到的:
该按钮位于错误的位置,因此此代码似乎与 Inno Setup 6 不完全兼容?
所以,在我的脚本中我有:
[Setup]
LicenseFile=..\..\..\EULA\EULA.rtf
[Code]
var PrintButton: TButton;
procedure PrintButtonClick(Sender: TObject);
var ResultCode :integer;
begin
log('test');
ExtractTemporaryFile('EULA.rtf');
//if not ShellExec('Print', ExpandConstant('{tmp}\EULA.rtf'),
// '', '', SW_SHOW, ewNoWait, ResultCode) then
if not ShellExec('', ExpandConstant('{tmp}\EULA.rtf'),
'', '', SW_SHOW, ewNoWait, ResultCode) then
log('test');
end;
procedure InitializeWizard();
begin
PrintButton := TButton.Create(WizardForm);
PrintButton.Caption := '&Print...';
PrintButton.Left := WizardForm.InfoAfterPage.Left + 96;
PrintButton.Top := WizardForm.InfoAfterPage.Height + 88;
PrintButton.OnClick := @PrintButtonClick;
PrintButton.Parent := WizardForm.NextButton.Parent;
end;
procedure CurPageChanged(CurPage: Integer);
begin
PrintButton.Visible := CurPage = wpLicense;
end;
我也不清楚哪个代码是正确的“打印”此协议。
这并不是关于 Inno Setup 6,而是关于WizardStyle=modern.
-
如果要将控件放置在页面底部,请使用相对于向导大小的坐标,而不是绝对坐标。或者更好的是,使用相对于您想要对齐的控件的坐标。该代码显然想要对齐Print按钮与其他按钮如Next, so do:
PrintButton.Top := WizardForm.NextButton.Top;
-
您正在使用WizardStyle=modern
,比经典向导更大。当时的InitializeWizard
所谓,现代风格尚未应用。所以即使是Next按钮未位于其最终位置。为了满足这一点,请使用akBottom
锚(如NextButton
does):
PrintButton.Anchors := [akLeft, akBottom];
这也是必须的,因为现代向导是用户可调整大小的,因此您需要将按钮粘在底部,即使向导大小稍后发生变化。
也可以看看将自定义按钮与 Inno Setup 取消按钮对齐
-
将按钮相对于WizardForm.InfoAfterPage.Left
这是无稽之谈,因为这总是0
。您可能想使用:
PrintButton.Left :=
WizardForm.OuterNotebook.Left + WizardForm.InnerNotebook.Left;
-
不要依赖默认大小,默认大小不会缩放:
您可以使用要对齐的其他控件的大小:
PrintButton.Width := WizardForm.NextButton.Width;
PrintButton.Height := WizardForm.NextButton.Height;
-
始终缩放偏移量和尺寸ScaleX and ScaleY. See 将图像/控件放置在 Inno Setup 自定义页面上。但如果您应用上述所有内容,您将不会留下任何固定的坐标或尺寸。
现在,无论您使用什么风格的 Inno Setup 向导,或者您的安装程序将在什么 DPI 上运行,您的代码都可以正常工作。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)