Inno设置图标模糊

时间:2015-08-17 09:35:50

标签: inno-setup

我面临以下几个问题 -

  1. 设置[Setup] SetupIconFile =完整图标路径并使用标准128像素图标制作Inno安装程序后。 在这里,我发现 - Inno设置安装程序文件图标,欢迎页面左上角小图标和任务栏图标模糊分辨率1920 X 1080& 125%dpi,这是我的机器的默认值。

  2. 我还找到了WizModernImage.bmp&所有安装页面上的WizModernSmallImage.bmp图像都有点模糊。

  3. 请告诉我 -

    一个。任何方式在左上角小图标显示正确的图像。

    湾任何设置/选项禁用或不显示欢迎页面左上角的小图标。

    ℃。无论如何要展示WizModernImage.bmp& WizModernSmallImage.bmp图像按分辨率/ dpi。

    谢谢。

    此致 沙市

1 个答案:

答案 0 :(得分:0)

要为每个DPI设置自定义BMP,您必须覆盖默认行为。 简单的例子:

[Setup]
AppName=My Program
AppVersion=1.5
DefaultDirName={pf}\My Program

[Files]
Source: ".\custom_bg\*"; DestDir: "{tmp}"; Flags: dontcopy nocompression; 
;sample names, corresponding to code: 
;wizard_96.bmp, wizard_120.bmp, wizard_144.bmp, wizard_168.bmp
;wizard_small_96.bmp, wizard_small_120.bmp, 
;wizard_small_144.bmp, wizard_small_168.bmp

[Code]
var
  DPIValString: String;

procedure CheckDPI;
    var
      CurrentDPI, StandardDPI, MediumDPI, LargeDPI, UltraDPI: Integer;
    begin
      // Get the current DPI
      CurrentDPI  := WizardForm.Font.PixelsPerInch;

      // Store defaults determined from Windows DPI settings
      StandardDPI := 96;  // 100%
      MediumDPI   := 120; // 125%
      LargeDPI    := 144; // 150%
      UltraDPI    := 168; // 175% introduced by Windows 10 

      if (CurrentDPI >= StandardDPI) and (CurrentDPI < MediumDPI) then 
      begin
          DPIValString := '_96';
      end
      else if (CurrentDPI >= MediumDPI) and (CurrentDPI < LargeDPI) then
      begin
          DPIValString := '_120';
      end
      else if (CurrentDPI >= LargeDPI) and (CurrentDPI < UltraDPI)then
      begin
          DPIValString := '_144';
      end
      else if (CurrentDPI >= UltraDPI) then
      begin
          DPIValString := '_168';
      end;
    end;

procedure InitializeWizard;
begin
  CheckDPI;
  ExtractTemporaryFile('wizard' + DPIValString + '.bmp');
  ExtractTemporaryFile('wizard_small' + DPIValString + '.bmp');
  if (FileExists(ExpandConstant('{tmp}\wizard' + DPIValString + '.bmp')))
   and (FileExists(ExpandConstant('{tmp}\wizard_small' + DPIValString + '.bmp'))) 
   then begin 
    with WizardForm.WizardSmallBitmapImage do
      Bitmap.LoadFromFile(ExpandConstant('{tmp}\wizard_small' + DPIValString + '.bmp'));
    with WizardForm.WizardBitmapImage do
      Bitmap.LoadFromFile(ExpandConstant('{tmp}\wizard' + DPIValString + '.bmp'));
  end; 
end;