Shashikant Shinde
Shashikant Shinde

Reputation: 11

Inno Setup Icon blurred

I am facing couple of issues as follows -

  1. After setting [Setup]SetupIconFile=full icon path and using a standard 128 pixel icon to make Inno setup installer. Here, I found - Inno setup installer file icon, Welcome page top left corner small icon and taskbar icon are blurred on resolution 1920 X 1080 & 125% dpi which is default for my machine.

  2. Also I found WizModernImage.bmp & WizModernSmallImage.bmp images are little bit blurred on all installation pages.

Please let me know -

a. Any way to show proper image at top left corner small icon.

b. Any setting / option to disable or do not show welcome page top left corner small icon.

c. Anyway to show WizModernImage.bmp & WizModernSmallImage.bmp images as per resolution / dpi.

Thank you.

Regards, Shashi

Upvotes: 1

Views: 924

Answers (1)

RobeN
RobeN

Reputation: 5456

In order to set custom BMP for each DPI you will have to override the default behavior. Simple example:

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

Upvotes: 0

Related Questions