Inno Setup的位图WizardImageFile(和WizardSmallImageFile)看起来很糟糕,因为当Windows 7启用了大型系统字体时,向导比平常大,但图像缩放得很糟糕.
有修复吗?
BitmapImage1.AutoSize := True; BitmapImage1.Align := alClient; BitmapImage1.Left := 0; BitmapImage1.Top := 0; BitmapImage1.stretch := True; BitmapImage1.Parent := Splash;
解决方法
这些是位图图像,它们自然会严重缩放.你很幸运,你自己的图像在缩放时看起来并不那么糟糕.
您必须为常见的缩放因子准备自己的一组图像,并动态选择正确的缩放因子.在Inno Setup中没有本机支持.
目前使用的常见缩放因子是100%,125%,150%和200%.所以你应该有四种尺寸的图像.
您可以使用WizardImageFile
和WizardSmallImageFile
指令分配100%大小的图像,并在使用大缩放时使用Pascal脚本覆盖它.
说我有这些图像文件:
WizardImage 100.bmp WizardImage 125.bmp WizardImage 150.bmp WizardImage 200.bmp WizardSmallImage 100.bmp WizardSmallImage 125.bmp WizardSmallImage 150.bmp WizardSmallImage 200.bmp
[Setup] ; Use 100% images by default WizardImageFile=WizardImage 100.bmp WizardSmallImageFile=WizardSmallImage 100.bmp [Files] ; Embed all other sizes to the installer Source: "WizardImage *.bmp"; Excludes: "* 100.bmp"; Flags: dontcopy Source: "WizardSmallImage *.bmp"; Excludes: "* 100.bmp"; Flags: dontcopy [Code] function GetScalingFactor: Integer; begin if WizardForm.Font.PixelsPerInch >= 192 then Result := 200 else if WizardForm.Font.PixelsPerInch >= 144 then Result := 150 else if WizardForm.Font.PixelsPerInch >= 120 then Result := 125 else Result := 100; end; procedure LoadEmbededScaledBitmap(Image: TBitmapImage; NameBase: string); var Name: String; FileName: String; begin Name := Format('%s %d.bmp',[NameBase,GetScalingFactor]); ExtractTemporaryFile(Name); FileName := ExpandConstant('{tmp}\' + Name); Image.Bitmap.LoadFromFile(FileName); DeleteFile(FileName); end; procedure InitializeWizard; begin { If using larger scaling,load the correct size of images } if GetScalingFactor > 100 then begin LoadEmbededScaledBitmap(WizardForm.WizardBitmapImage,'WizardImage'); LoadEmbededScaledBitmap(WizardForm.WizardBitmapImage2,'WizardImage'); LoadEmbededScaledBitmap(WizardForm.WizardSmallBitmapImage,'WizardSmallImage'); end; end;
您可能希望对SelectDirBitmapImage,SelectGroupBitmapImage和PreparingErrorBitmapImage执行相同的操作.
也可以看看:
> @L_403_2@
> Inno Setup Placing image/control on custom page