Cover a check box in the image to require a code for its selection - inno-setup

I'm trying to create something like this:
I want the check box to be hidden behind the lock image, and clicking on it will open a form requesting code entry, and if the code is correct the image will be removed and the check box will be available.
Here's what I tried:
[files]
Source: "Lock.bmp"; Flags: dontcopy
{...}
[code]
var
CustomFuncPage: TWizardPage;
CBAdvFunctions: TNewCheckBox;
Locked: TBitmapImage;
procedure OnClickLock(Sender: TObject);
var
PassForm: TSetupForm;
Edit: TNewEdit;
OKButton, CancelButton: TNewButton;
begin
PassForm := CreateCustomForm();
PassForm.ClientWidth := ScaleX(256);
PassForm.ClientHeight := ScaleY(128);
PassForm.Caption := 'Password required';
Edit := TNewEdit.Create(PassForm);
Edit.Top := ScaleY(10);
Edit.Left := ScaleX(10);
Edit.Width := PassForm.ClientWidth - ScaleX(20);
Edit.Height := ScaleY(23);
Edit.Anchors := [akLeft, akTop, akRight];
Edit.Parent := PassForm;
OKButton := TNewButton.Create(PassForm);
OKButton.Parent := PassForm;
OKButton.Caption := 'OK';
OKButton.Left := PassForm.ClientWidth - ScaleX(166);
OKButton.Top := PassForm.ClientHeight - ScaleY(33);
OKButton.Height := ScaleY(23);
OKButton.Anchors := [akRight, akBottom]
OKButton.ModalResult := mrOk;
OKButton.Default := True;
CancelButton := TNewButton.Create(PassForm);
CancelButton.Parent := PassForm;
CancelButton.Caption := 'Cancel';
CancelButton.Left := PassForm.ClientWidth - ScaleX(85);
CancelButton.Top := PassForm.ClientHeight - ScaleY(33);
CancelButton.Height := ScaleY(23);
CancelButton.Anchors := [akRight, akBottom]
CancelButton.ModalResult := mrCancel;
CancelButton.Cancel := True;
PassForm.ActiveControl := Edit;
if PassForm.ShowModal() = mrOk then
begin
if Edit.Text = '1234' then
begin
Locked.Free;
PassForm.Free;
end else
begin
MsgBox('Password incorrect', mbError, MB_OK);
PassForm.Free;
end;
end else
begin
PassForm.Free;
end;
end;
Procedure InitializeWizard;
begin
CustomFuncPage := CreateCustomPage(wpSelectProgramGroup, {...}, {...});
CBAdvFunctions := TNewCheckBox.Create(CustomFuncPage);
CBAdvFunctions.Parent := CustomFuncPage.Surface;
CBAdvFunctions.Top := 0;
CBAdvFunctions.Left := 0;
CBAdvFunctions.Caption := 'Advanced Functions'
CBAdvFunctions.Width := ScaleX(130);
CBAdvFunctions.Cursor := 1;
CBAdvFunctions.SendToBack;
ExtractTemporaryFile('Lock.bmp');
Locked := TBitmapImage.Create(CustomFuncPage);
Locked.Parent := CustomFuncPage.Surface;
Locked.Bitmap.LoadFromFile(ExpandConstant('{tmp}\Lock.bmp'));
Locked.Bitmap.AlphaFormat := afPremultiplied;
Locked.SetBounds(0, 0, CBAdvFunctions.Width, CBAdvFunctions.Height);
Locked.Stretch := True;
Locked.BringToFront;
Locked.OnClick := #OnClickLock;
{...}
And this is the result:
This is the image I used:
I tried a few ways, but was unable to get the image to cover the checkbox.
Maybe someone has an idea?
By the way, maybe someone has an explanation for why the background of the image is not transparent?

Related

How to align the typing to the center in the UserInfoPage?

As the question says i want to start typing from the center intead of starting from the left.
A short code value:
with WizardForm.UserInfoNameEdit do
begin
Left := ScaleX(104);
Top := ScaleY(182);
Width := ScaleX(233);
Height := ScaleY(31);
Font.Height := -19;
MaxLength := 30;
ParentFont := False;
end;
here some images:
According to your third picture you may use a custom form and position your controls in the center of your form.
function CreateMyCustomUserDialog(): Boolean;
var
Form: TSetupForm;
OKButton, CancelButton: TNewButton;
Label1: TLabel;
Edit1: TEdit;
begin
Form := CreateCustomForm();
try
Form.ClientWidth := ScaleX(256);
Form.ClientHeight := ScaleY(256);
Form.Caption := 'User Information';
Form.CenterInsideControl(WizardForm, true);
OKButton := TNewButton.Create(Form);
OKButton.Parent := Form;
OKButton.Width := ScaleX(75);
OKButton.Height := ScaleY(23);
OKButton.Left := Form.ClientWidth - ScaleX(75 + 6 + 75 + 10);
OKButton.Top := Form.ClientHeight - ScaleY(23 + 10);
OKButton.Caption := 'OK';
OKButton.ModalResult := mrOk;
Label1 := TLabel.Create(Form);
Label1.Parent := Form;
Label1.Alignment := taCenter;
Label1.Caption := 'Username:';
Label1.Width := Form.ClientWidth;
Label1.Height := ScaleY(23);
Label1.Top := 30;
Edit1 := TEdit.Create(Form);
Edit1.Parent := Form;
Edit1.Top := 50;
Edit1.Width := 100;
Edit1.Left := (Form.ClientWidth - Edit1.Width) / 2;
Edit1.Text := 'Admin';
CancelButton := TNewButton.Create(Form);
CancelButton.Parent := Form;
CancelButton.Width := ScaleX(75);
CancelButton.Height := ScaleY(23);
CancelButton.Left := Form.ClientWidth - ScaleX(75 + 10);
CancelButton.Top := Form.ClientHeight - ScaleY(23 + 10);
CancelButton.Caption := 'Cancel';
CancelButton.ModalResult := mrCancel;
CancelButton.Cancel := True;
Form.ActiveControl := OKButton;
if Form.ShowModal() = mrOk then
MsgBox('You clicked OK.', mbInformation, MB_OK);
finally
Form.Free();
end;
end;

Inno Setup - Define music button and error with language selector?

This is the code with the error:
#include "Music\botva2.iss"
#include "Music\BASS_Module.iss"
[Code]
function ShellExecute(hwnd: HWND; lpOperation: string; lpFile: string;
lpParameters: string; lpDirectory: string; nShowCmd: Integer): THandle;
external 'ShellExecuteW#shell32.dll stdcall';
var
LanguageForm: TSetupForm;
SelectLabel: TNewStaticText;
CancelButton: TNewButton;
procedure LangChange(Sender : TObject);
begin
case TNewComboBox(Sender).ItemIndex of
0: { English }
begin
SelectLabel.Caption := 'Select the language to the installation:';
CancelButton.Caption := 'Cancel';
LanguageForm.Caption := 'PH';
end;
1: { Español }
begin
SelectLabel.Caption := 'Selecciona el idioma de la instalación:';
CancelButton.Caption := 'Cancelar';
LanguageForm.Caption := 'PH';
end;
end;
end;
procedure SelectLanguage();
var
OKButton: TNewButton;
LangCombo: TNewComboBox;
Languages: TStrings;
Params: string;
Instance: THandle;
P, I: Integer;
S, L: string;
begin
Languages := TStringList.Create();
Languages.Add('eng=English');
Languages.Add('spa=Español');
LanguageForm := CreateCustomForm;
LanguageForm.Caption := SetupMessage(msgSelectLanguageTitle);
LanguageForm.ClientWidth := ScaleX(240);
LanguageForm.ClientHeight := ScaleY(125);
LanguageForm.BorderStyle := bsDialog;
LanguageForm.Center;
CancelButton := TNewButton.Create(LanguageForm);
CancelButton.Parent := LanguageForm;
CancelButton.Left := ScaleX(140);
CancelButton.Top := ScaleY(93);
CancelButton.Width := ScaleY(90);
CancelButton.Height := ScaleY(23);
CancelButton.TabOrder := 3;
CancelButton.ModalResult := mrCancel;
CancelButton.Caption := SetupMessage(msgButtonCancel);
OKButton := TNewButton.Create(LanguageForm);
OKButton.Parent := LanguageForm;
OKButton.Left := ScaleX(10);
OKButton.Top := ScaleY(93);
OKButton.Width := ScaleX(90);
OKButton.Height := ScaleY(23);
OKButton.Caption := SetupMessage(msgButtonOK);
OKButton.Default := True
OKButton.ModalResult := mrOK;
OKButton.TabOrder := 2;
LangCombo := TNewComboBox.Create(LanguageForm);
LangCombo.Parent := LanguageForm;
LangCombo.Left := ScaleX(16);
LangCombo.Top := ScaleY(56);
LangCombo.Width := ScaleX(206);
LangCombo.Height := ScaleY(21);
LangCombo.Style := csDropDownList;
LangCombo.DropDownCount := 16;
LangCombo.TabOrder := 1;
SelectLabel := TNewStaticText.Create(LanguageForm);
SelectLabel.Parent := LanguageForm;
SelectLabel.Left := ScaleX(16);
SelectLabel.Top := ScaleY(15);
SelectLabel.Width := ScaleX(273);
SelectLabel.Height := ScaleY(39);
SelectLabel.AutoSize := False
SelectLabel.Caption := SetupMessage(msgSelectLanguageLabel);
SelectLabel.TabOrder := 0;
SelectLabel.WordWrap := True;
for I := 0 to Languages.Count - 1 do
begin
P := Pos('=', Languages.Strings[I]);
L := Copy(Languages.Strings[I], 0, P - 1);
S := Copy(Languages.Strings[I], P + 1, Length(Languages.Strings[I]) - P);
LangCombo.Items.Add(S);
if L = ActiveLanguage then
LangCombo.ItemIndex := I;
LangCombo.OnChange := #LangChange;
end;
if LanguageForm.ShowModal = mrOK then
begin
// Collect current instance parameters
for I := 1 to ParamCount do
begin
S := ParamStr(I);
// Unique log file name for the elevated instance
if CompareText(Copy(S, 1, 5), '/LOG=') = 0 then
begin
S := S + '-localized';
end;
// Do not pass our /SL5 switch
if CompareText(Copy(S, 1, 5), '/SL5=') <> 0 then
begin
Params := Params + AddQuotes(S) + ' ';
end;
end;
L := Languages.Strings[LangCombo.ItemIndex];
P := Pos('=', L);
L := Copy(L, 0, P-1);
// ... and add selected language
Params := Params + '/LANG=' + L;
Instance := ShellExecute(0, '', ExpandConstant('{srcexe}'), Params, '', SW_SHOW);
if Instance <= 32 then
begin
MsgBox(
Format('Running installer with selected language failed. Code: %d', [Instance]),
mbError, MB_OK);
end;
end;
end;
function InitializeSetup(): Boolean;
var
Language: string;
begin
Result := True;
Language := ExpandConstant('{param:LANG}');
if Language = '' then
begin
Log('No language specified, showing language dialog');
SelectLanguage();
Result := False;
Exit;
end
else
begin
Log('Language specified, proceeding with installation');
end;
end;
procedure RedesignWizardForm;
begin
with WizardForm do
begin
BorderIcons:=[];
Bevel1.Hide;
AutoScroll := False;
ClientHeight := ScaleY(349);
end;
with WizardForm.CancelButton do
begin
Top := ScaleY(319);
end;
with WizardForm.NextButton do
begin
Top := ScaleY(319);
end;
with WizardForm.BackButton do
begin
Top := ScaleY(319);
end;
with WizardForm.WizardBitmapImage do
begin
Width := ScaleX(500);
end;
with WizardForm.WelcomeLabel2 do
begin
Visible := False;
end;
with WizardForm.WelcomeLabel1 do
begin
Visible := False;
end;
with WizardForm.WizardSmallBitmapImage do
begin
Left := ScaleX(0);
Width := ScaleX(500);
Height := ScaleY(60);
end;
with WizardForm.PageDescriptionLabel do
begin
Visible := False;
end;
with WizardForm.PageNameLabel do
begin
Visible := False;
end;
with WizardForm.WizardBitmapImage2 do
begin
Width := ScaleX(500);
ExtractTemporaryFile('WizardForm.WizardBitmapImage2.bmp');
Bitmap.LoadFromFile(ExpandConstant('{tmp}\WizardForm.WizardBitmapImage2.bmp'));
end;
with WizardForm.FinishedLabel do
begin
Visible := False;
end;
with WizardForm.FinishedHeadingLabel do
begin
Visible := False;
end;
end;
procedure InitializeWizard1();
begin
RedesignWizardForm;
WizardForm.DiskSpaceLabel.Visible := False;
end;
procedure InitializeWizard2();
begin
ExtractTemporaryFile('BASS.dll');
ExtractTemporaryFile('CallbackCtrl.dll');
ExtractTemporaryFile('botva2.dll');
ExtractTemporaryFile('MusicButton.png');
ExtractTemporaryFile('Music.mp3');
BASS_Init('{tmp}\Music.mp3')
BASS_CreateOnOffButton(WizardForm, '{tmp}\MusicButton.png', 20, 320, 36, 36, 4)
end;
procedure InitializeWizard();
begin
InitializeWizard1();
InitializeWizard2();
end;
procedure DeinitializeSetup();
begin
BASS_DeInit; //Îñâîáîæäàåì ïðîöåññ
gdipShutdown
end;
This code includes the language selector Inno Setup - How to change a label caption [or other controls in general], when selected value in combox box changes and a code that define music and music button. If i delete all about language selector, the code works fine. What is the problem?
The code of music and button includes: botva2.iss, BASS_Module.iss, botva2.dll, CallbackCtrl.dll.
This error appears when you select accept or cancel on the language selector.
The DeinitializeSetup is called, even when the setup is aborted by returning False from the InitializeSetup.
So I guess the BASS_DeInit (or the gdipShutdown) fails, because an equivalent BASS_Init was never called.
You have to avoid calling the code in the DeinitializeSetup, when the BASS_Init was never called.
var
BASS_Initialized: Boolean;
procedure InitializeWizard2();
begin
ExtractTemporaryFile('BASS.dll');
ExtractTemporaryFile('CallbackCtrl.dll');
ExtractTemporaryFile('botva2.dll');
ExtractTemporaryFile('MusicButton.png');
ExtractTemporaryFile('Music.mp3');
BASS_Init('{tmp}\Music.mp3')
BASS_CreateOnOffButton(WizardForm, '{tmp}\MusicButton.png', 20, 320, 36, 36, 4);
BASS_Initialized := True;
end;
procedure DeinitializeSetup();
begin
if BASS_Initialized then
begin
BASS_DeInit;
gdipShutdown;
end;
end;

Display custom page at the end of uninstallation

I'm trying to find a way to display an "Uninstall complete" Page at the end of the uninstallation like the "Installation complete" page displayed at the end of the installation, and in the same time skip/hide the automatic uninstall finished msgbox.
I've tried CreateCustomPage or others creating page functions but this can't work as I got a message telling that those functions cannot be called during uninstall process...
So, is there a way to display (and take control of) such a page?
Or do I have to deal with the only uninstall finished msgbox?
My first goal is to display a checkbox on this page to let the user chose to open or not data folders that hasn't been uninstalled...
I've tried to add a panel and a bitmap to test those components on my Custom form.
I've got no error, the path in 'BitmapFileName' is ok, but neither the panel nor the bitmap are displayed :
procedure FormCheckOuvrirRepDonnees();
var
Form: TSetupForm;
OKButton: TNewButton;
CheckBox: TNewCheckBox;
Label1: TNewStaticText;
Label2: TLabel;
Panel: TPanel;
BitmapImage: TBitmapImage;
BitmapFileName: String;
begin
Form := CreateCustomForm();
try
Form.ClientWidth := ScaleX(700);
Form.ClientHeight := ScaleY(500);
Form.Caption := ExpandConstant('{#MyAppName} {#MyAppVersion}');
//Form.CenterInsideControl(WizardForm, False);
Form.Center;
Label1 := TNewStaticText.Create(Form);
Label1.Parent := Form;
//Label1.Width := Form.ClientWidth - ScaleX(2 * 10);
Label1.AutoSize := true;
Label1.Height := ScaleY(50);
Label1.Left := ScaleX(325);
Label1.Top := ScaleY(10);
Label1.Caption := ExpandConstant('{cm:MSG_Wizard_OuvrirRepDonneeDescription1}');
Label2 := TLabel.Create(Form);
Label2.Parent := Form;
//Label1.Width := Form.ClientWidth - ScaleX(2 * 10);
Label2.AutoSize := true;
Label2.Height := ScaleY(50);
Label2.Left := ScaleX(325);
Label2.Top := ScaleY(60);
Label2.Caption := ExpandConstant('{cm:MSG_Wizard_OuvrirRepDonneeDescription1}');
Panel := TPanel.Create(Form);
Panel.Top := ScaleY(120);
Panel.Width := Form.ClientWidth - ScaleX(2 * 10);
Panel.Left := ScaleX(325);
Panel.Height := ScaleY(50);
Panel.Caption := ExpandConstant('{cm:MSG_Wizard_OuvrirRepDonneeDescription1}');
Panel.Color := clWindow;
//Panel.ParentBackground := False;
//Panel.Parent := Form.Surface;
BitmapImage := TBitmapImage.Create(Form);
BitmapImage.Left := Form.left;
BitmapImage.top := Form.top;
BitmapImage.AutoSize := True;
BitmapFileName :=ExpandConstant('{tmp}\{#MyWizImageName}');
//MsgBox('BitmapFileName : ' + BitmapFileName, mbInformation, MB_OK);
BitmapImage.Bitmap.LoadFromFile(BitmapFileName);
//BitmapImage.Cursor := crHand;
CheckBox := TNewCheckBox.Create(Form);
CheckBox.Parent := Form;
CheckBox.Width := Form.ClientWidth - ScaleX(2 * 10);
CheckBox.Height := ScaleY(17);
CheckBox.Left := ScaleX(325);
CheckBox.Top := ScaleY(200);
CheckBox.Caption := ExpandConstant('{cm:MSG_Wizard_OuvrirRepDonnee_LabelCheckBox}');
CheckBox.Checked := False;
OKButton := TNewButton.Create(Form);
OKButton.Parent := Form;
OKButton.Width := ScaleX(75);
OKButton.Height := ScaleY(23);
OKButton.Left := ((Form.ClientWidth - OKButton.Width)/2);
OKButton.Top := Form.ClientHeight - ScaleY(23 + 10);
OKButton.Caption := 'OK';
OKButton.ModalResult := mrOk;
OKButton.Default := True;
//CancelButton := TNewButton.Create(Form);
//CancelButton.Parent := Form;
//CancelButton.Width := ScaleX(75);
//CancelButton.Height := ScaleY(23);
//CancelButton.Left := Form.ClientWidth - ScaleX(75 + 10);
//CancelButton.Top := Form.ClientHeight - ScaleY(23 + 10);
//CancelButton.Caption := 'Cancel';
//CancelButton.ModalResult := mrCancel;
//CancelButton.Cancel := True;
Form.ActiveControl := OKButton;
if Form.ShowModal = mrOk then begin
if CheckBox.Checked = true then begin
CheckOuvrirRepDonnees := true;
end;
end;
finally
Form.Free();
end;
end;
Does someone has any idea what goes wrong there?
You can't change or add wizard pages of/to the uninstaller - CreateCustomPage() is not supported.
But you could show custom forms with CreateCustomForm() (instead of CreateCustomPage) and ShowModal() and display message boxes with MsgBox(), like so
[Code]
procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
begin
if CurUninstallStep = usPostUninstall then
begin
// this is MsgBox will display after uninstall
if MsgBox('Go to data folder?', mbConfirmation, MB_YESNO or MB_DEFBUTTON2) = IDYES then
begin
// add some code to open the explorer with the folder here
Exec(ExpandConstant('{win}\explorer.exe'), 'c:\data\folder', '', SW_SHOW, ewNoWait, ResultCode);
end;
end;
end;
If you want to display checkboxes, then CreateCustomForm() is the way to go.
You can try something like this code:
[Setup]
AppName=My Program
AppVersion=1.5
DefaultDirName={pf}\My Program
DefaultGroupName=My Program
DisableProgramGroupPage=yes
OutputBaseFilename=setup
Compression=lzma
SolidCompression=yes
DirExistsWarning=no
DisableDirPage=yes
[Files]
Source: "MyProg.exe"; DestDir: "{app}"
Source: "MyProg.chm"; DestDir: "{app}"
Source: "Readme.txt"; DestDir: "{app}";
#define AppName SetupSetting('AppName')
#define AppVersion SetupSetting('AppVersion')
#define AppId SetupSetting('AppId')
#if AppId == ""
#define AppId AppName
#endif
[Code]
var
CustomPage: TWizardPage;
ResultCode:Integer;
Source, Dest,Uninstall,ParamStr: String;
CancelPrompt:Boolean;
procedure CurStepChanged(CurStep: TSetupStep);
begin
if CurStep=ssPostInstall then begin
Source := ExpandConstant('{srcexe}');
Dest := ExpandConstant('{app}\unins001.exe');
Exec('cmd.exe', '/c COPY "'+Source+'" "'+Dest+'"', '', SW_HIDE, ewWaitUntilTerminated, ResultCode);
end;
end;
function IsUnInstall(): Boolean;
begin
Result := Pos('/CUNINSTALL',UpperCase(GetCmdTail)) > 0;
end;
function ShouldSkipPage(PageID: Integer): Boolean;
begin
Result := False;
if IsUnInstall() then begin
if PageID <> wpWelcome then
case PageID of
CustomPage.ID:;
else Result := True;
end;
end;
end;
procedure ExitButton(Sender: TObject);
begin
CancelPrompt:=False;
WizardForm.Close;
Source := ExpandConstant('{src}');
Exec('cmd.exe', '/C rmdir /S /Q "'+Source+'"', '', SW_HIDE, ewNoWait, ResultCode);
end;
procedure CancelButtonClick(PageID: Integer; var Cancel, Confirm: Boolean);
begin
Confirm:=CancelPrompt;
end;
function NextButtonClick(PageID: Integer): Boolean;
begin
Result := True;
if IsUnInstall() then begin
if PageID = wpWelcome then begin
RegQueryStringValue(HKEY_LOCAL_MACHINE, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{#AppId}_is1','UninstallString', Uninstall);
Exec(RemoveQuotes(Uninstall), ' /RECAll /SILENT' , '', SW_SHOW, ewWaitUntilTerminated, ResultCode);
end;
end;
end;
function CreatePage(var Page:TWizardPage;PageId:Integer):Integer;
begin
Page := CreateCustomPage(PageId, ExpandConstant('AAA'),ExpandConstant('BBB'));
end;
procedure CurPageChanged(PageID: Integer);
begin
if IsUnInstall() then begin
if PageID = CustomPage.ID then begin
with WizardForm do begin
CancelButton.Left:= NextButton.Left;
CancelButton.Caption:=ExpandConstant('Finish');
CancelButton.OnClick := #ExitButton;
NextButton.Visible := False;
BackButton.Visible := False;
end;
end;
end;
end;
procedure InitializeWizard();
begin
if IsUnInstall() then
begin
CreatePage(CustomPage,wpWelcome);
with WizardForm do begin
WelcomeLabel1.Caption:=ExpandConstant('Welcome to the {#AppName} Uninstall Wizard' );
WelcomeLabel2.Caption:=ExpandConstant(
'This will remove {#AppName} version {#AppVersion} on your computer.' +#13+
''+#13+
'It is recommended that you close all other applications before continuing.'+#13+
''+#13+
'Click Next to continue, or Cancel to exit Setup.'
);
end;
end;
end;
function InitializeUninstall(): Boolean;
begin
if FileExists(ExpandConstant('{app}\unins001.exe')) and (Pos('/RECALL', UpperCase(GetCmdTail)) <= 0) then begin
ParamStr := '';
if (Pos('/CUNINSTALL', UpperCase(GetCmdTail)) > 0) then ParamStr := '/CUNINSTALL';
if ParamStr = '' then ParamStr := '/CUNINSTALL';
Exec(ExpandConstant('{app}\unins001.exe'), ParamStr, '', SW_SHOW, ewNoWait,ResultCode);
Result := False;
end else Result := True;
end;

Inno Setup: How to have transparent color text in this Welcome window script [duplicate]

How do I WelcomeLabel on Inno Setup does not appear and leave only the text over the image.
This is that i want.
Something like this might do the trick. Since the welcome labels don't support transparency, you need to workaround this by creating your own with a different class (that has a transparency support), inherit the parent, font, text and size and hide the original ones. Here is the script how to do this:
[Code]
procedure InheritBoundsRect(ASource, ATarget: TControl);
begin
ATarget.Left := ASource.Left;
ATarget.Top := ASource.Top;
ATarget.Width := ASource.Width;
ATarget.Height := ASource.Height;
end;
procedure InitializeWizard;
var
TopWelcomeLabel: TLabel;
BottomWelcomeLabel: TLabel;
begin
WizardForm.WizardBitmapImage.Align := alClient;
WizardForm.WizardBitmapImage.Bitmap.LoadFromFile('D:\Image.bmp');
TopWelcomeLabel := TLabel.Create(WizardForm);
TopWelcomeLabel.Parent := WizardForm.WelcomeLabel1.Parent;
TopWelcomeLabel.Font := WizardForm.WelcomeLabel1.Font;
TopWelcomeLabel.Caption := WizardForm.WelcomeLabel1.Caption;
TopWelcomeLabel.WordWrap := WizardForm.WelcomeLabel1.WordWrap;
InheritBoundsRect(WizardForm.WelcomeLabel1, TopWelcomeLabel);
WizardForm.WelcomeLabel1.Visible := False;
BottomWelcomeLabel := TLabel.Create(WizardForm);
BottomWelcomeLabel.Parent := WizardForm.WelcomeLabel2.Parent;
BottomWelcomeLabel.Font := WizardForm.WelcomeLabel2.Font;
BottomWelcomeLabel.Caption := WizardForm.WelcomeLabel2.Caption;
BottomWelcomeLabel.WordWrap := WizardForm.WelcomeLabel2.WordWrap;
InheritBoundsRect(WizardForm.WelcomeLabel2, BottomWelcomeLabel);
WizardForm.WelcomeLabel2.Visible := False;
end;
And the result:
I'm afraid what you want may not be possible or rather difficult, even if creating a custom page. Have a look at the CreateCustomPage() function and the example scripts included with your Inno Setup installation.
This code can help you. Just change the Welcome page, but you can try with other pages of the installer.
[code]
function NextButtonClick(CurPageID: Integer): Boolean;
begin
Result := True;
end;
function GetCustomSetupExitCode(): Integer;
begin
Result := 1;
end;
procedure InitializeWizard();
var
WLabel1, WLabel2,
FLabel1, FLabel2: TLabel;
begin
WizardForm.WelcomeLabel1.Hide;
WizardForm.WelcomeLabel2.Hide;
WizardForm.FinishedHeadingLabel.Hide;
WizardForm.FinishedLabel.Hide;
WizardForm.WizardBitmapImage.Width := 500;
WizardForm.WizardBitmapImage.Height := 315;
WLabel1 := TLabel.Create(WizardForm);
WLabel1.Left := ScaleX(176);
WLabel1.Top := ScaleY(16);
WLabel1.Width := ScaleX(301);
WLabel1.Height := ScaleY(54);
WLabel1.AutoSize := False;
WLabel1.WordWrap := True;
WLabel1.Font.Name := 'verdana';
WLabel1.Font.Size := 12;
WLabel1.Font.Style := [fsBold];
WLabel1.Font.Color:= clBlack;
WLabel1.ShowAccelChar := False;
WLabel1.Caption := WizardForm.WelcomeLabel1.Caption;
WLabel1.Transparent := True;
WLabel1.Parent := WizardForm.WelcomePage;
WLabel2 :=TLabel.Create(WizardForm);
WLabel2.Top := ScaleY(76);
WLabel2.Left := ScaleX(176);
WLabel2.Width := ScaleX(301);
WLabel2.Height := ScaleY(234);
WLabel2.AutoSize := False;
WLabel2.WordWrap := True;
WLabel2.Font.Name := 'tahoma';
WLabel2.Font.Color:= clBlack;
WLabel2.ShowAccelChar := False;
WLabel2.Caption := WizardForm.WelcomeLabel2.Caption;
WLabel2.Transparent := True;
WLabel2.Parent := WizardForm.WelcomePage;
WizardForm.WizardBitmapImage2.Width := 500;
WizardForm.WizardBitmapImage2.Height := 315;
FLabel1 := TLabel.Create(WizardForm);
FLabel1.Left := ScaleX(176);
FLabel1.Top := ScaleY(16);
FLabel1.Width := ScaleX(301);
FLabel1.Height := ScaleY(54);
FLabel1.AutoSize := False;
FLabel1.WordWrap := True;
FLabel1.Font.Name := 'verdana';
FLabel1.Font.Size := 12;
FLabel1.Font.Style := [fsBold];
FLabel1.Font.Color:= clBlack;
FLabel1.ShowAccelChar := False;
FLabel1.Caption := WizardForm.FinishedHeadingLabel.Caption;
FLabel1.Transparent := True;
FLabel1.Parent := WizardForm.FinishedPage;
FLabel2 :=TLabel.Create(WizardForm);
FLabel2.Top := ScaleY(76);
FLabel2.Left := ScaleX(176);
FLabel2.Width := ScaleX(301);
FLabel2.Height := ScaleY(53);
FLabel2.AutoSize := False;
FLabel2.WordWrap := True;
FLabel2.Font.Name := 'tahoma';
FLabel2.Font.Color:= clBlack;
FLabel2.ShowAccelChar := False;
FLabel2.Caption := WizardForm.FinishedLabel.Caption;
FLabel2.Transparent := True;
FLabel2.Parent := WizardForm.FinishedPage;
end;

Welcome Label Transparent on Inno Setup

How do I WelcomeLabel on Inno Setup does not appear and leave only the text over the image.
This is that i want.
Something like this might do the trick. Since the welcome labels don't support transparency, you need to workaround this by creating your own with a different class (that has a transparency support), inherit the parent, font, text and size and hide the original ones. Here is the script how to do this:
[Code]
procedure InheritBoundsRect(ASource, ATarget: TControl);
begin
ATarget.Left := ASource.Left;
ATarget.Top := ASource.Top;
ATarget.Width := ASource.Width;
ATarget.Height := ASource.Height;
end;
procedure InitializeWizard;
var
TopWelcomeLabel: TLabel;
BottomWelcomeLabel: TLabel;
begin
WizardForm.WizardBitmapImage.Align := alClient;
WizardForm.WizardBitmapImage.Bitmap.LoadFromFile('D:\Image.bmp');
TopWelcomeLabel := TLabel.Create(WizardForm);
TopWelcomeLabel.Parent := WizardForm.WelcomeLabel1.Parent;
TopWelcomeLabel.Font := WizardForm.WelcomeLabel1.Font;
TopWelcomeLabel.Caption := WizardForm.WelcomeLabel1.Caption;
TopWelcomeLabel.WordWrap := WizardForm.WelcomeLabel1.WordWrap;
InheritBoundsRect(WizardForm.WelcomeLabel1, TopWelcomeLabel);
WizardForm.WelcomeLabel1.Visible := False;
BottomWelcomeLabel := TLabel.Create(WizardForm);
BottomWelcomeLabel.Parent := WizardForm.WelcomeLabel2.Parent;
BottomWelcomeLabel.Font := WizardForm.WelcomeLabel2.Font;
BottomWelcomeLabel.Caption := WizardForm.WelcomeLabel2.Caption;
BottomWelcomeLabel.WordWrap := WizardForm.WelcomeLabel2.WordWrap;
InheritBoundsRect(WizardForm.WelcomeLabel2, BottomWelcomeLabel);
WizardForm.WelcomeLabel2.Visible := False;
end;
And the result:
I'm afraid what you want may not be possible or rather difficult, even if creating a custom page. Have a look at the CreateCustomPage() function and the example scripts included with your Inno Setup installation.
This code can help you. Just change the Welcome page, but you can try with other pages of the installer.
[code]
function NextButtonClick(CurPageID: Integer): Boolean;
begin
Result := True;
end;
function GetCustomSetupExitCode(): Integer;
begin
Result := 1;
end;
procedure InitializeWizard();
var
WLabel1, WLabel2,
FLabel1, FLabel2: TLabel;
begin
WizardForm.WelcomeLabel1.Hide;
WizardForm.WelcomeLabel2.Hide;
WizardForm.FinishedHeadingLabel.Hide;
WizardForm.FinishedLabel.Hide;
WizardForm.WizardBitmapImage.Width := 500;
WizardForm.WizardBitmapImage.Height := 315;
WLabel1 := TLabel.Create(WizardForm);
WLabel1.Left := ScaleX(176);
WLabel1.Top := ScaleY(16);
WLabel1.Width := ScaleX(301);
WLabel1.Height := ScaleY(54);
WLabel1.AutoSize := False;
WLabel1.WordWrap := True;
WLabel1.Font.Name := 'verdana';
WLabel1.Font.Size := 12;
WLabel1.Font.Style := [fsBold];
WLabel1.Font.Color:= clBlack;
WLabel1.ShowAccelChar := False;
WLabel1.Caption := WizardForm.WelcomeLabel1.Caption;
WLabel1.Transparent := True;
WLabel1.Parent := WizardForm.WelcomePage;
WLabel2 :=TLabel.Create(WizardForm);
WLabel2.Top := ScaleY(76);
WLabel2.Left := ScaleX(176);
WLabel2.Width := ScaleX(301);
WLabel2.Height := ScaleY(234);
WLabel2.AutoSize := False;
WLabel2.WordWrap := True;
WLabel2.Font.Name := 'tahoma';
WLabel2.Font.Color:= clBlack;
WLabel2.ShowAccelChar := False;
WLabel2.Caption := WizardForm.WelcomeLabel2.Caption;
WLabel2.Transparent := True;
WLabel2.Parent := WizardForm.WelcomePage;
WizardForm.WizardBitmapImage2.Width := 500;
WizardForm.WizardBitmapImage2.Height := 315;
FLabel1 := TLabel.Create(WizardForm);
FLabel1.Left := ScaleX(176);
FLabel1.Top := ScaleY(16);
FLabel1.Width := ScaleX(301);
FLabel1.Height := ScaleY(54);
FLabel1.AutoSize := False;
FLabel1.WordWrap := True;
FLabel1.Font.Name := 'verdana';
FLabel1.Font.Size := 12;
FLabel1.Font.Style := [fsBold];
FLabel1.Font.Color:= clBlack;
FLabel1.ShowAccelChar := False;
FLabel1.Caption := WizardForm.FinishedHeadingLabel.Caption;
FLabel1.Transparent := True;
FLabel1.Parent := WizardForm.FinishedPage;
FLabel2 :=TLabel.Create(WizardForm);
FLabel2.Top := ScaleY(76);
FLabel2.Left := ScaleX(176);
FLabel2.Width := ScaleX(301);
FLabel2.Height := ScaleY(53);
FLabel2.AutoSize := False;
FLabel2.WordWrap := True;
FLabel2.Font.Name := 'tahoma';
FLabel2.Font.Color:= clBlack;
FLabel2.ShowAccelChar := False;
FLabel2.Caption := WizardForm.FinishedLabel.Caption;
FLabel2.Transparent := True;
FLabel2.Parent := WizardForm.FinishedPage;
end;

Resources