问题描述
我想将动画gif居中放置在安装程序(WizardSizePercent=150
)中所有页面的中间,而不使用值.
I would like to center my animated gif right in the middle of all pages in my installer ( WizardSizePercent=150
) without using values.
这是我的代码:
var
ParentForm: TSetupForm;
begin
TimerID := 0;
SlideID := 0;
ContentHeight := ParentForm.Top + ParentForm.Height;
ExtractTemporaryFile('Image1.bmp');
ExtractTemporaryFile('Image2.bmp');
ExtractTemporaryFile('Image3.bmp');
ExtractTemporaryFile('Image4.bmp');
ExtractTemporaryFile('Image5.bmp');
ExtractTemporaryFile('Image6.bmp');
Panel := TPanel.Create(ParentForm);
Panel.Parent := ParentForm;
Panel.Left := 185;
Panel.Top := ParentForm.Top + 130;
Panel.Width := 1000;
Panel.Height := 380;
Panel.Visible := True;
BackImage := TBitmapImage.Create(ParentForm);
BackImage.Parent := Panel;
BackImage.Width:= 1000;
BackImage.Height:= 380;
BackImage.Left := (Panel.Height - BackImage.Height) div 2;
BackImage.Top := (Panel.Height - BackImage.Height) div 2;
BackImage.Bitmap.LoadFromFile(ExpandConstant('{tmp}\Image1.bmp'));
StartSlideTimer;
end;
如何更改ContentHeight
,Panel
和BackImage
的值?
推荐答案
仅在 WizardSizePercent
被应用.所以在 CurPageChanged
中,而不是在InitializeWizard
中.
或者更好的是,拥有一个更强大的解决方案,例如即使使用 WizardResizable
,也可以通过更新图像坐标来响应WizardForm.OnResize
(或者Panel
坐标-尽管我不明白它的目的).例如,请参见在Inno Setup中将控件宽度设置为自定义页面的一半SurfaceWidth不能正常工作.
Or better, to have a more robust solution, that works e.g. even with WizardResizable
, respond to WizardForm.OnResize
by updating the image coordinates (or rather the Panel
coordinates – though I do not understand its purpose). For an example, see Setting control width to half of custom page SurfaceWidth does not work correctly in Inno Setup.
还请注意,您不能使用常量坐标.您的图片在DPI较高的显示器上无法正确居中.要么缩放坐标,要么例如检查 Inno Setup在自定义页面上放置图片/控件.或者,以您的情况为佳,如果您根据图像和窗口的大小以编程方式计算居中坐标–为此,请检查在Inno Setup中,如何在窗口中居中放置一些文本?
Also note that you cannot use constant coordinates. Your image would not center correctly on high DPI displays. Either scale the coordinates – for that check for example Inno Setup Placing image/control on custom page. Or in your case, it would be better, if you calculate the centered coordinates programmatically based on the image and window sizes – for that, check the In Inno Setup, how do I center some text in the window?
这篇关于Inno Setup-如何在调整大小的向导中居中放置动画gif的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!