【问题标题】:Inno Setup WizardImageFile looks bad with font scaling on Windows 7Inno Setup WizardImageFile 在 Windows 7 上的字体缩放看起来很糟糕
【发布时间】:2014-10-24 07:49:39
【问题描述】:

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 pascalscript dpi-aware


    【解决方案1】:

    这些是位图图像,它们的缩放比例自然很差。你很幸运,你自己的图片在缩放后看起来没有那么糟糕。

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

    现在常用的比例因子有 100%、125%、150% 和 200%。所以你应该有四种尺寸的图片,比如:

    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 中列出您的图像版本即可。您可以使用通配符:

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

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

    下面的例子和 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 LoadEmbededScaledImage(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
        LoadEmbededScaledImage(WizardForm.WizardBitmapImage, 'WizardImage');
        LoadEmbededScaledImage(WizardForm.WizardBitmapImage2, 'WizardImage');
        LoadEmbededScaledImage(WizardForm.WizardSmallBitmapImage, 'WizardSmallImage');
      end;
    end;
    

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


    另见:

    【讨论】:

      猜你喜欢
      • 2012-12-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-05-08
      • 2013-08-24
      • 2012-06-04
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多