在Inno Setup中添加按钮旁边的文本

时间:2016-11-08 07:56:23

标签: inno-setup

如何在p.waitFor()

旁边添加文字

enter image description here

这是我的剧本:

Play / Mute button

1 个答案:

答案 0 :(得分:2)

与添加按钮的方式相同。创建一个新控件(TLabel),并将WizardForm分配给控件的Parent属性,将其添加到表单中。

添加标签的基本代码是:

var
  MyLabel: TLabel;
begin
  MyLabel := TLabel.Create(WizardForm);
  MyLabel.Parent := WizardForm;
  MyLabel.Left := ...;
  MyLabel.Top := ...;
  MyLabel.Caption := '...';
end;

在没有您的代码的情况下将它放在一起并将标签相对于按钮放置:

procedure InitializeWizard();
var
  TuneLabel: TLabel;
begin
  ...
  if ... then
  begin
    ...
    SoundCtrlButton := TNewButton.Create(WizardForm);
    ...

    { Creating a new TLabel control }
    TuneLabel := TLabel.Create(WizardForm);
    { Adding it to the wizard form }
    TuneLabel.Parent := WizardForm;
    { Setting caption }
    TuneLabel.Caption := 'tune';
    { Aligning it to the right of the button }
    TuneLabel.Left := SoundCtrlButton.Left + SoundCtrlButton.Width + ScaleX(8);
    { Vertically aligning it with the button }
    { Doing this only after the caption is set and the label is auto-sized. } 
    TuneLabel.Top :=
      SoundCtrlButton.Top + ((SoundCtrlButton.Height - TuneLabel.Height) div 2);
  end;
end;