Windows 7上的字体缩放时,Inno Setup WizardImageFile看起来很糟糕 [英] Inno Setup WizardImageFile looks bad with font scaling on Windows 7

查看:147
本文介绍了Windows 7上的字体缩放时,Inno Setup WizardImageFile看起来很糟糕的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

用于Inno设置WizardImageFile(和WizardSmallImageFile)的位图看起来很糟糕,因为当Windows 7启用了较大的系统字体时,该向导比平时要大,但是图像缩放的比例是错误的.

Bitmap for Inno Setup WizardImageFile (and WizardSmallImageFile) looks terrible because when Windows 7 has the large system fonts enabled, the Wizard is bigger than usual, but the images are scaled terrible wrong.

有修复程序吗?

如果我在这样的地方添加自己的图片,则不会出现类似的问题:

There is no similar issue if I add own picture somewhere like this:

BitmapImage1.AutoSize := True;
BitmapImage1.Align := alClient;
BitmapImage1.Left := 0;
BitmapImage1.Top := 0;
BitmapImage1.stretch := True;
BitmapImage1.Parent := Splash;

推荐答案

这些是位图图像,它们的缩放比例自然很差.您很幸运,缩放后自己的图像看起来没有那么差.

These are bitmap images, they naturally scale badly. You are just lucky that your own images do not look that bad when scaled.

您必须为常见的缩放因子准备自己的图像集.

You have to prepare your own set of images for common scaling factors.

当今使用的通用比例因子是100%,125%,150%和200%.因此,您应该为图像设置四种尺寸,例如:

Common scaling factors used nowadays are 100%, 125%, 150% and 200%. So you should have four sizes for the images, like:

WizardImage 100.bmp
WizardImage 125.bmp
WizardImage 150.bmp
WizardImage 200.bmp
WizardSmallImage 100.bmp
WizardSmallImage 125.bmp
WizardSmallImage 150.bmp
WizardSmallImage 200.bmp

Inno Setup可以自5.6起自动选择最佳图像版本. 只需在 WizardImageFile WizardSmallImageFile .您可以使用通配符:

Inno Setup can automatically select the best version of the image since 5.6. Just list your versions of the images in the WizardImageFile and WizardSmallImageFile. You can use wildcards:

[Setup]
WizardImageFile=WizardImage *.bmp
WizardImageFile=WizardSmallImage *.bmp


在Inno Setup的旧版本上(或者如果您需要自定义选择算法,或者在向导中有其他自定义图像时),则必须以编程方式选择图像.


On older versions of Inno Setup (or if your need to customize the selection algorithm or when you have additional custom images in the wizard), you would have to select the images programatically.

以下示例与Inno Setup 5.6大致相同:

The following example does more or less the same what Inno Setup 5.6:

[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;


您可能想对SelectDirBitmapImageSelectGroupBitmapImagePreparingErrorBitmapImage做同样的事情.


You might want to do the same for the SelectDirBitmapImage, the SelectGroupBitmapImage and the PreparingErrorBitmapImage.

另请参阅:

  • How to detect and "fix" DPI settings with Inno Setup?
  • Inno Setup Placing image/control on custom page

这篇关于Windows 7上的字体缩放时,Inno Setup WizardImageFile看起来很糟糕的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆