如何在 Inno Setup 中在斜角线上创建标签

Ari*_*ful 4 label inno-setup

昨天我发现了一个新的设置。它在斜线上有一个标签。那么,如何在 Inno Setup 中创建和设置像这样的斜角线标签呢?

喜欢这张图片

Mar*_*ryl 5

它看起来像一个组框控件(在 Delphi/VCL 中称为TGroupBox),而不是斜角。

但组框控件在 Inno Setup 中并未公开。

作为替代方案,只需将 放在 的TLabel顶部即可TBevel。确保将标签的Transparent属性设置为False

在 Windows Vista 和更新版本中,您还可以在周围添加头发空间作为填充。为此,您需要 Inno Setup 的 Unicode 版本(截至 Inno Setup 6 的唯一版本)。

procedure InitializeWizard;
var
  Page: TWizardPage;
  Bevel: TBevel;
  Caption: TLabel;
begin
  Page := CreateCustomPage(wpWelcome, '', '');

  Bevel := TBevel.Create(WizardForm);
  with Bevel do
  begin
    Parent := Page.Surface;
    Shape := bsFrame;
    Left := ScaleX(0);
    Top := ScaleY(8);
    Width := ScaleX(417);
    Height := ScaleY(220);
  end;

  Caption := TLabel.Create(WizardForm);
  with Caption do
  begin
    Parent := Page.Surface;
    Left := Bevel.Left + ScaleX(8);
    Top := Bevel.Top - ScaleY(6);
    Transparent := False;
    Caption := 'Caption';

    { On Vista and newer, add padding using a hair space }
    if GetWindowsVersion >= $06000000 then
      Caption := #$200A + Caption + #$200A;
  end;
end;
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述