简体   繁体   English

Inno Setup PageDescriptionLabel相互重叠

[英]Inno Setup PageDescriptionLabel overlapping each other

I recently made the switch to Inno Setup and it's fantastic! 我最近切换到了Inno Setup,这太棒了! I was pretty much able to get most of the things to work except I'm having a trouble on something. 除了在某些方面遇到麻烦之外,我几乎能够完成大部分工作。

Basically, I'm trying to create my own header design and I was trying to make Page Title/Page Description transparent. 基本上,我试图创建自己的标题设计,并且试图使页面标题/页面描述透明。 However they are overlapping each other on page change. 但是,它们在页面更改时彼此重叠。 (Please refer to the picture). (请参考图片)。

http://img703.imageshack.us/img703/6180/88647320.png

Code: 码:

procedure InheritBoundsRect(ASource, ATarget: TControl);
begin
  ATarget.Left := ASource.Left;
  ATarget.Top := ASource.Top;
  ATarget.Width := ASource.Width;
  ATarget.Height := ASource.Height;
end;

procedure CurPageChanged(CurPageID: Integer);
var
  TD: TLabel;
begin
    TD := TLabel.Create(WizardForm);
    TD.Parent := WizardForm.PageDescriptionLabel.Parent;
    TD.Caption := WizardForm.PageDescriptionLabel.Caption;
    TD.WordWrap := WizardForm.PageDescriptionLabel.WordWrap;
    TD.Transparent := True;
    InheritBoundsRect(WizardForm.PageDescriptionLabel, TD);
    TD.AutoSize := True;
end;

Also, I'm not even sure if this is the best way of doing this so if anyone have any suggestion, I'de love to hear them. 另外,我什至不确定这是否是最好的方法,所以如果有人有任何建议,我很想听听他们的建议。

As you've correctly pointed out, you're creating your label many times. 正如您正确指出的那样,您正在多次创建标签。 To be more specific, every time the new page is shown (every time the next or back buttons are pressed). 更具体地说,每次显示新页面时(每次按下next或back按钮)。 You need to create the label only once, ideally in the wizard form initialization event, like the InitializeWizard . 您只需创建一次标签,理想情况下是在向导形式的初始化事件中创建标签,例如InitializeWizard Except that, you then need to change the label's caption every time the page changes. 除此之外,每次页面更改时,您都需要更改标签的标题。 As best for this you need to use that CurPageChanged event. 为此,您最好使用该CurPageChanged事件。 So, to make transparent page description label (what I missed) you can use script like follows: 因此,要制作透明的页面描述标签(我错过了什么),可以使用如下脚本:

[Code]
var
  DescLabel: TLabel;

procedure InheritBoundsRect(ASource, ATarget: TControl);
begin
  ATarget.Left := ASource.Left;
  ATarget.Top := ASource.Top;
  ATarget.Width := ASource.Width;
  ATarget.Height := ASource.Height;
end;

procedure InitializeWizard;
begin
  DescLabel := TLabel.Create(WizardForm);
  DescLabel.Parent := WizardForm.PageDescriptionLabel.Parent;  
  DescLabel.WordWrap := WizardForm.PageDescriptionLabel.WordWrap;
  DescLabel.AutoSize := WizardForm.PageDescriptionLabel.AutoSize;
  DescLabel.Transparent := True;
  InheritBoundsRect(WizardForm.PageDescriptionLabel, DescLabel);

  WizardForm.PageDescriptionLabel.Visible := False;
end;

procedure CurPageChanged(CurPageID: Integer);
begin
  DescLabel.Caption := WizardForm.PageDescriptionLabel.Caption;
end;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM