1

I have an customized welcome and finish pages with different images on both. my issue is exactly similar to this question Inno Setup WizardImageFile looks bad with font scaling on Windows 7 and i have referred this solution the installer is picking up the different images based on scaling(if scaling is 100% then it opt for 100, if 200% then 200). but i want it should display on welcome page and finish page. but 1.My welcome page looks empty, i want the image should be displayed in welcome page. 2.The images is displaying in rest of the pages(like ready to install and others) at top left : but i don't want to display there. 3.At finish page it looks as i expected. any ways here ?

[Setup]
AppName=My Program
AppVersion=1.5
WizardStyle=modern
DefaultDirName={autopf}\My Program
DefaultGroupName=My Program
UninstallDisplayIcon={app}\MyProg.exe
Compression=lzma2
SolidCompression=yes
OutputDir=D:\repos\isetups
DisableWelcomePage=yes
; Use 100% images by default
WizardImageFile= WizardImage 100.bmp,WizardImage 125.bmp
WizardSmallImageFile=WizardSmallImage 100.bmp,WizardSmallImage 125.bmp

[Files]
Source: "MyProg.exe"; DestDir: "{app}"
Source: "MyProg.chm"; DestDir: "{app}"
Source: "Readme.txt"; DestDir: "{app}"; Flags: isreadme
Source: "WizardImage *.bmp"; Flags: dontcopy
Source: "WizardSmallImage *.bmp";Flags: dontcopy

[Icons]
Name: "{group}\My Program"; Filename: "{app}\MyProg.exe"

[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]);
log(Name);
ExtractTemporaryFile(Name);
FileName := ExpandConstant(Name);
Image.Bitmap.LoadFromFile(FileName);
//DeleteFile(FileName);
end;

procedure InitializeWizard;
var
WelcomePage: TWizardPage;

begin
WelcomePage := CreateCustomPage(wpWelcome, '', '');
WelcomePageID := WelcomePage.ID;
BitmapImage := TBitmapImage.Create(WizardForm);
BitmapImage.Parent := WizardForm.InnerPage;
BitmapImage.Left := 0;
BitmapImage.Top := 0;
BitmapImage.AutoSize := True;
BitmapImage.Cursor := crHand;
BitmapImage.Visible := False;
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;
end;

Ready to install: enter image description here

Welcome Page: enter image description here

ekta
  • 23
  • 6
  • Where do you want to display the image on the welcome page? You put the image on the "inner page". There's no inner page on the welcome page. I do not see any image on your ready page either. – Martin Prikryl May 26 '20 at 07:28
  • @MartinPrikryl yes I want to display image on the welcome page like this https://stackoverflow.com/questions/34705492/custom-welcome-and-finished-page-with-stretched-image-in-inno-setup. it was displaying but not scaled one now it is displaying empty almost blank scree. and you can see a black box kind of thing at the top left in the corner in Ready page the image is compressed. – ekta May 26 '20 at 07:45
  • I do not see any of the code from that question in your code. – Martin Prikryl May 26 '20 at 07:53

1 Answers1

0

If you want to show scaled and stretched image on the Welcome page:

Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992