Inno Setup - 如何在调整大小的向导中将动画 gif 居中
Inno Setup - how to center an animated gif in resized wizard
我想在安装程序 (WizardSizePercent=150
) 的所有页面中间将我的动画 gif 居中,而不使用值。
这是我的代码:
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
(both explicit and implied by WizardStyle=modern
)仅在InitializeWizard
之后适用。因此,明确定位在 InitializeWizard
中的控件之后可能会放错位置。
将图像仅放在 WizardSizePercent
is applied. So e.g. in the CurPageChanged
之后,而不是 InitializeWizard
.
或者更好的是,有一个更强大的解决方案,例如即使 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 .
在许多情况下,您还可以使用 Anchors
属性 让控件自动调整大小。有关示例,请参阅 .
另请注意,您不能使用常量坐标。您的图像无法在高 DPI 显示器上正确居中。要么缩放坐标——例如检查 . 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?
我想在安装程序 (WizardSizePercent=150
) 的所有页面中间将我的动画 gif 居中,而不使用值。
这是我的代码:
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
(both explicit and implied by WizardStyle=modern
)仅在InitializeWizard
之后适用。因此,明确定位在 InitializeWizard
中的控件之后可能会放错位置。
将图像仅放在 WizardSizePercent
is applied. So e.g. in the CurPageChanged
之后,而不是 InitializeWizard
.
或者更好的是,有一个更强大的解决方案,例如即使 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
在许多情况下,您还可以使用 Anchors
属性 让控件自动调整大小。有关示例,请参阅
另请注意,您不能使用常量坐标。您的图像无法在高 DPI 显示器上正确居中。要么缩放坐标——例如检查