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.
Is there a fix?
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.
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 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
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.
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 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;
You might want to do the same for the SelectDirBitmapImage, the SelectGroupBitmapImage and the PreparingErrorBitmapImage.
See also:
How to detect and "fix" DPI settings with Inno Setup?
Inno Setup Placing image/control on custom page
Related
This question already has an answer here:
Inno Setup Unicode encoding issue with messages in ISS script
(1 answer)
Closed 4 years ago.
In my [run] section I have this entry:
Filename: "{win}\hh.exe"; \
Parameters: "{app}\MeetSchedAssist.chm::/msa-revision-history.htm"; \
WorkingDir: "{app}"; \
Flags: nowait postinstall runmaximized; \
Description: "{cm:ViewChangeHistory}"
When I run my installer in English it looks fine:
A user has just recorded a video installing it on a Japanese computer:
There are two issues:
The buttons of the GUI are all cropped.
The "View Change History" custom string is gibberish.
The English custom messages file (UTF-8 encoded) has:
English.ViewChangeHistory=View Change History
The Japanese custom messages file (UTF-8 encoded) has:
Japanese.ViewChangeHistory=変更履歴を表示
Why is it not displaying correctly? I am using the most recent version of Inno Setup Unicode. I do know that the user is using a Ultra HD monitor.
Also, I am rebuilding the run list like this:
type
TRunEntry = record
Caption: string;
Checked: Boolean;
Object: TObject;
end;
procedure RebuildRunList;
var
RunEntries: array of TRunEntry;
I: Integer;
begin
// Save run list ...
SetArrayLength(RunEntries, WizardForm.RunList.Items.Count);
for I := 0 to WizardForm.RunList.Items.Count - 1 do
begin
RunEntries[I].Caption := WizardForm.RunList.ItemCaption[I];
RunEntries[I].Checked := WizardForm.RunList.Checked[I];
RunEntries[I].Object := WizardForm.RunList.ItemObject[I];
end;
// ... clear it ...
WizardForm.RunList.Items.Clear;
// ... and re-create
for I := 0 to GetArrayLength(RunEntries) - 1 do
begin
// the first three entries are radio buttons
if (I = 0) or (I = 1) or (I = 2) then
begin
WizardForm.RunList.AddRadioButton(
RunEntries[I].Caption, '', 0, RunEntries[I].Checked, True, RunEntries[I].Object);
end
else
begin
WizardForm.RunList.AddCheckBox(
RunEntries[I].Caption, '', 0, RunEntries[I].Checked, True, True, True,
RunEntries[I].Object);
end;
end;
end;
procedure CurPageChanged(CurPageID: Integer);
begin
if CurPageID = wpFinished then
begin
// Only now is the RunList populated.
// Two entries are on 64-bit systems only.
if IsWin64 then RebuildRunList;
end;
end;
Update
I commented out the code that rebuilds the run list and it made no difference on my PC:
However, the skinning works correctly. So the button position matter must be related to the users using a ultra HD configuration and and/or scaled text.
Then I commentted out the skinning code and tried again on my PC. No change:
I really don't understand why this is happening!
Update
I include the custom messages like this:
[CustomMessages]
#include AddBackslash(SourcePath) + ".\l.jpn\CustomMessagesJapanese.txt"
This depends on how you're including the text.
In an ISL file with MessagesFile
According to http://www.jrsoftware.org/ishelp/topic_unicode.htm, it is not legal to save an ISL file in UTF-8.
You must save it as ANSI encoded with the code page specified in the file.
Directly in your ISS file or using #include
Alternatively you can use UTF-8 strings directly in your iss file by using Language.Key values directly in a local [Messages] or [CustomMessages] section, like so:
[CustomMessages]
English.ViewChangeHistory=View Change History
Japanese.ViewChangeHistory=変更履歴を表示
You can also #include an external file that uses the same format.
In both cases (whether directly in the iss file or in a #included file), you need to ensure that the file is saved as UTF-8 with BOM.
I'm using this solution:
Display image in top panel of Inno Setup wizard instead of page title and description
And I want set parameters like this:
WizardForm.WizardSmallBitmapImage.Visible := False;
WizardForm.PageDescriptionLabel.Color := clBlack;
WizardForm.PageNameLabel.Color := clBlack;
WizardForm.PageDescriptionLabel.Font.Color := clWhite;
WizardForm.PageNameLabel.Font.Color := clWhite;
but... i don't know how to make black backgrounds shorter under title and description. As you can see black strips going on to the face. It is possible at all?
I want something like this:
Already i have this:
To change labels width use theirs .Width property.
procedure InitializeWizard();
begin
{ ... }
WizardForm.PageDescriptionLabel.Width :=
WizardForm.PageDescriptionLabel.Width - ScaleX(120);
WizardForm.PageNameLabel.Width :=
WizardForm.PageNameLabel.Width - ScaleX(120);
end;
Or you can make the labels transparent:
Inno Setup - Transparency under text in page name and description labels
I'm making an Inno setup for my application. I'm using this command:
[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"; LicenseFile: "C:\Users\LocDaiLe\Desktop\license.txt"
to display a license agreement window, but I want two license agreement window right after each others. How can I archieve this - thank you
You have to code the second license page as a custom page.
You can start with the CreateOutputMsgMemoPage function, which creates a page with a memo. Then, you just add radio buttons for accepting the license.
[Files]
; Embed the second license files
; (the part after underscore must match the Name parameter from Languages section)
Source: "license2_english.txt"; Flags: dontcopy
Source: "license2_czech.txt"; Flags: dontcopy
; Other languages
[Code]
var
SecondLicensePage: TOutputMsgMemoWizardPage;
License2AcceptedRadio: TRadioButton;
License2NotAcceptedRadio: TRadioButton;
procedure CheckLicense2Accepted(Sender: TObject);
begin
// Update Next button when user (un)accepts the license
WizardForm.NextButton.Enabled := License2AcceptedRadio.Checked;
end;
function CloneLicenseRadioButton(Source: TRadioButton): TRadioButton;
begin
Result := TRadioButton.Create(WizardForm);
Result.Parent := SecondLicensePage.Surface;
Result.Caption := Source.Caption;
Result.Left := Source.Left;
Result.Top := Source.Top;
Result.Width := Source.Width;
Result.Height := Source.Height;
// Needed for WizardStyle=modern / WizardResizable=yes
Result.Anchors := Source.Anchors;
Result.OnClick := #CheckLicense2Accepted;
end;
procedure InitializeWizard();
var
LicenseFileName: string;
LicenseFilePath: string;
begin
// Create second license page, with the same labels as the original license page
SecondLicensePage :=
CreateOutputMsgMemoPage(
wpLicense, SetupMessage(msgWizardLicense), SetupMessage(msgLicenseLabel),
SetupMessage(msgLicenseLabel3), '');
// Shrink license box to make space for radio buttons
SecondLicensePage.RichEditViewer.Height := WizardForm.LicenseMemo.Height;
// Load license
// Loading ex-post, as Lines.LoadFromFile supports UTF-8,
// contrary to LoadStringFromFile.
LicenseFileName := 'license2_' + ActiveLanguage + '.txt';
ExtractTemporaryFile(LicenseFileName);
LicenseFilePath := ExpandConstant('{tmp}\' + LicenseFileName);
SecondLicensePage.RichEditViewer.Lines.LoadFromFile(LicenseFilePath);
DeleteFile(LicenseFilePath);
// Clone accept/do not accept radio buttons for the second license
License2AcceptedRadio :=
CloneLicenseRadioButton(WizardForm.LicenseAcceptedRadio);
License2NotAcceptedRadio :=
CloneLicenseRadioButton(WizardForm.LicenseNotAcceptedRadio);
// Initially not accepted
License2NotAcceptedRadio.Checked := True;
end;
procedure CurPageChanged(CurPageID: Integer);
begin
// Update Next button when user gets to second license page
if CurPageID = SecondLicensePage.ID then
begin
CheckLicense2Accepted(nil);
end;
end;
For a generalization of the solution that allows adding any number of license pages, see:
Inno Setup - Add 4 license pages
Original (first) license page:
Coded (second) license page:
I also had to display two license files, but I did it by adding these two lines to the setup sectiony:
LicenseFile={#MyFileSource}License.rtf
InfoBeforeFile={#MyFileSource}License2.rtf
Works like a charm for me
Is it possible to change the top image on a wizard form depending on the wizard form. I can change the left side image but would like to change the top (small image).
procedure CurPageChanged(CurPageID: Integer);
begin
if CurPageID = 4 then
filename:= 'babylontoolbar.bmp'
else
filename:= 'label2-crop.bmp';
ExtractTemporaryFile(filename);
(*WizardForm.WizardSmallImageFile.Bitmap.LoadFromFile(ExpandConstant('{tmp}\'+FileName));*)
WizardForm.WizardBitmapImage.Bitmap.LoadFromFile(ExpandConstant('{tmp}\' + FileName));
end;
I just would like to know how to reference the small file to replace the WizardSmallImageFile which does not work.
The WizardSmallImageFile directive is mapped to the WizardSmallBitmapImage control of the WizardForm, so in code you can access it this way (anyway, do not hardcode page ID numbers, but instead use the intended PageID constants):
procedure CurPageChanged(CurPageID: Integer);
var
FileName: string;
begin
if CurPageID = wpInfoBefore then
FileName := 'babylontoolbar.bmp'
else
FileName := 'label2-crop.bmp';
ExtractTemporaryFile(FileName);
WizardForm.WizardSmallBitmapImage.Bitmap.LoadFromFile(ExpandConstant('{tmp}\' + FileName));
end;
Once again TLama has the answers, just have to keep googling. For those trying to do something similar to this and having problems finding the answer check out Skipping custom pages based on optional components in Inno Setup
Why my bitmap is not full screen size?
BitmapImage1 := TBitmapImage.Create(Page);
Its somehow made smaller by INNO ?
Tom, you must set the Parent,Align and Stretch properties to fill the background pf the custom page with your image.
try out this code
var
Page : TWizardPage;
BackgroundBitmapImage: TBitmapImage;
s: string;
begin
Page := CreateCustomPage(wpWelcome, 'Custom Page', 'Test');
ExtractTemporaryFile('background.bmp');
s:=ExpandConstant('{tmp}')+'\background.bmp';
BackgroundBitmapImage := TBitmapImage.Create(Page);
BackgroundBitmapImage.Bitmap.LoadFromFile(s);
BackgroundBitmapImage.Parent := Page.Surface;
BackgroundBitmapImage.Align:=alCLient;
BackgroundBitmapImage.Stretch:=True;
end;
is very nousy to do.
You must split your image in almost 3 piece
for WizardForm.MainPanel ( top strip of 60px)
for WizardForm.InnerPage (Center panel around Surface)
for mainPage.Surface (Inside inner Panel)
So is a big work of precise cutting....