正在尝试在 wpSelectComponents 表单上放置一些文本。
我可以在这个 WizardForm 上显示一个按钮,我可以显示一个面板(通过将表面声明为 WizardForm 和 visible=False
直到 CurrPageId = wpSelectComponents
)但我似乎无法显示一条短信。
我可以在面板内显示文本(作为标题)但我不能使用 chr(13)
来创建换行符。
是否可以在预定义的向导页面上显示文本? (两个简短的段落)。
最佳答案
如果您要显示带有按钮的面板和带有多行文本的标签,则只能显示在特定页面的内容下方(在本例中为选择组件页面) ,您可能会从以下脚本中获得灵感:
[Setup]
AppName=My Program
AppVersion=1.5
DefaultDirName={pf}\My Program
OutputDir=userdocs:Inno Setup Examples Output
[Components]
Name: "main"; Description: "Main Files"; Types: full compact custom; Flags: fixed
Name: "help"; Description: "Help Files"; Types: full
Name: "help\english"; Description: "English"; Types: full
Name: "help\dutch"; Description: "Dutch"; Types: full
[Code]
var
Panel: TPanel;
procedure FuncButtonClick(Sender: TObject);
begin
MsgBox('You did it!', mbInformation, MB_OK);
end;
procedure InitializeWizard;
var
DescLabel: TLabel;
FuncButton: TNewButton;
ContentHeight: Integer;
begin
ContentHeight := WizardForm.OuterNotebook.Top +
WizardForm.OuterNotebook.Height;
Panel := TPanel.Create(WizardForm);
Panel.Parent := WizardForm;
Panel.Left := 4;
Panel.Top := ContentHeight + 4;
Panel.Width := WizardForm.BackButton.Left - 8;
Panel.Height := WizardForm.ClientHeight - ContentHeight - 8;
Panel.Visible := False;
FuncButton := TNewButton.Create(WizardForm);
FuncButton.Parent := Panel;
FuncButton.Left := (Panel.Height - FuncButton.Height) div 2;
FuncButton.Top := (Panel.Height - FuncButton.Height) div 2;
FuncButton.Caption := 'Click me!';
FuncButton.OnClick := @FuncButtonClick;
DescLabel := TLabel.Create(WizardForm);
DescLabel.Parent := Panel;
DescLabel.AutoSize := True;
DescLabel.Caption := 'Hello,' #13#10 + 'I''m your label! :-)';
DescLabel.Left := FuncButton.Left + FuncButton.Width + 8;
DescLabel.Top := (Panel.Height - DescLabel.Height) div 2;
end;
procedure CurPageChanged(CurPageID: Integer);
begin
Panel.Visible := CurPageID = wpSelectComponents;
end;
结果如下:
关于inno-setup - wpSelectComponents 上的 Inno Setup 文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16500010/