gpt4 book ai didi

inno-setup - Inno Setup 相对于现有按钮定位自定义按​​钮

转载 作者:行者123 更新时间:2023-12-03 22:47:00 24 4
gpt4 key购买 nike

我知道可以使用以下代码在任何页面上创建自定义按钮并使用绝对值定位它:

//Create the About button
AboutButton := TButton.Create(WizardForm);
AboutButton.Caption := '&About';
AboutButton.Width := ScaleX(75);
AboutButton.Height := ScaleY(23);
AboutButton.Left := WizardForm.InfoAfterPage.Left + 10;
AboutButton.Top := WizardForm.InfoAfterPage.Height + 90;
AboutButton.OnClick := @AboutButtonClick;
AboutButton.Parent := WizardForm.NextButton.Parent;

唯一的问题是,由于它使用绝对值进行定位,如果用户打开了 Windows 缩放(在屏幕分辨率 > 放大或缩小文本和其他项目下)并且缩放设置为中 125%,则按钮会出现与其他内置按钮不对齐,导致一团糟。因此,有没有一种方法可以将任何新创建的自定义按钮与内置按钮相关联,以便它们始终按预期显示在一行中?或者有没有其他解决方案可以解决我忽略的这种扩展困境?

最佳答案

我会这样写:

  AboutButton := TButton.Create(WizardForm);
AboutButton.Caption := '&About';
AboutButton.Left := WizardForm.InfoAfterPage.Left + (WizardForm.ClientWidth -
(WizardForm.CancelButton.Left + WizardForm.CancelButton.Width));
// sets Left position from the Page Left
// + already scaled gap calculated on the basis of TLama's recommendations
AboutButton.Width := WizardForm.NextButton.Width;
// sets same Width as NextButton
AboutButton.Top := WizardForm.NextButton.Top;
// sets same Top position as NextButton
AboutButton.Height := WizardForm.NextButton.Height;
// sets same Height as NextButton
AboutButton.OnClick := @AboutButtonClick;
AboutButton.Parent := WizardForm.NextButton.Parent;

例子:

96 (Default)

120 (125%)

144 (150%)

关于inno-setup - Inno Setup 相对于现有按钮定位自定义按​​钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28328781/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com