我Panel
在自定义页面上放置了一个,并将其宽度设置为SurfaceWidth
。然后我将其宽度更改为SurfaceWidth div 2
。结果如下:
从屏幕截图中可以看到,新面板的宽度绝对不等于SurfaceWidth div 2
。为什么?
这是代码:
[Setup]
WizardStyle=modern
[Code]
procedure InitializeWizard();
var
Page: TWizardPage;
Panel: TPanel;
begin
Page := CreateCustomPage(wpWelcome, 'Custom wizard page controls', 'TButton and others');
Panel := TPanel.Create(Page);
Panel.Width := Page.SurfaceWidth div 2;
Panel.Left := 0;
Panel.Height := 46;
Panel.Anchors := [akLeft, akTop, akRight];
Panel.Caption := 'TPanel';
Panel.Color := clWindow;
Panel.BevelKind := bkFlat;
Panel.BevelOuter := bvNone;
Panel.ParentBackground := False;
Panel.Parent := Page.Surface;
end;
那是因为akRight
inPanel.Anchors
和modern
WizardStyle
(或者WizardSizePercent
它暗示的是120 )。该向导仅在之后缩放InitializeWizard
。使用akRight
,面板宽度将随向导线性增加(不成比例增加)。有解决方案,但是它们取决于您实际上希望面板在可调整大小的向导中的行为方式(modern
样式也暗示)。
另请参阅Inno设置-如何在调整大小的向导中居中放置动画gif。
如果要将面板保持一半大小,请在调整向导大小时(由于WizardSizePercent
或由于导致用户自动调整WizardResizable
),请处理WizardForm.OnResize
:
[Code]
var
Page: TWizardPage;
Panel: TPanel;
procedure WizardFormResize(Sender: TObject);
begin
Panel.Width := Page.SurfaceWidth div 2;
end;
procedure InitializeWizard();
begin
Page := CreateCustomPage(
wpWelcome, 'Custom wizard page controls', 'TButton and others');
Panel := TPanel.Create(Page);
Panel.Width := Page.SurfaceWidth div 2;
// ...
WizardForm.OnResize := @WizardFormResize;
end;
确保不设置akRight
锚点。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句