加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

inno-setup – Inno Setup WizardImageFile在Windows 7上使用字

发布时间:2020-12-15 10:12:45 所属栏目:大数据 来源:网络整理
导读:Inno Setup的位图WizardImageFile(和WizardSmallImageFile)看起来很糟糕,因为当Windows 7启用了大型系统字体时,向导比平常大,但图像缩放得很糟糕. 有修复吗? 如果我在这样的地方添加自己的图片,则没有类似的问题: BitmapImage1.AutoSize := True;BitmapIma
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%.所以你应该有四种尺寸的图像.

您可以使用WizardImageFileWizardSmallImageFile指令分配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 GetScalingFactor > 100 then 
  begin
    LoadEmbededScaledBitmap(WizardForm.WizardBitmapImage,'WizardImage');
    LoadEmbededScaledBitmap(WizardForm.WizardBitmapImage2,'WizardImage');
    LoadEmbededScaledBitmap(WizardForm.WizardSmallBitmapImage,'WizardSmallImage');
  end;
end;

您可能希望对SelectDirBitmapImage,SelectGroupBitmapImage和PreparingErrorBitmapImage执行相同的操作.

也可以看看:

> How to detect and “fix” DPI settings with Inno Setup?
> Inno Setup Placing image/control on custom page

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读