Skip to content
Draft
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
87 commits
Select commit Hold shift + click to select a range
728b580
Add test style hook for custom backgrounds.
martijnlaan Oct 31, 2025
70a3520
Merge branch 'main' into FormBackgroundStyleHook
martijnlaan Nov 4, 2025
5227c55
Make the hook use TBitmapImageImplementation so it can paint images a…
martijnlaan Nov 4, 2025
fff9135
Add missing ParentBackground properties.
martijnlaan Nov 4, 2025
58f0284
Merge branch 'main' into FormBackgroundStyleHook
martijnlaan Nov 5, 2025
5eb30ab
Improve hook + make it support Setup.
martijnlaan Nov 5, 2025
fbe2cc6
Add WizardBackColor and WizardBackColorDynamicDark directives.
martijnlaan Nov 5, 2025
e15344e
Improve hook to not keep a reference but make a temporary copy instead.
martijnlaan Nov 5, 2025
cae60fc
Merge branch 'main' into FormBackgroundStyleHook
martijnlaan Nov 5, 2025
13b1242
Add support for empty bitmaps.
martijnlaan Nov 5, 2025
46b819d
Add support for not having wizard images. Does not change layout.
martijnlaan Nov 5, 2025
4096d37
Cleanup.
martijnlaan Nov 5, 2025
569e84f
Merge branch 'main' into FormBackgroundStyleHook
martijnlaan Nov 5, 2025
75bd74c
Merge branch 'main' into FormBackgroundStyleHook
martijnlaan Nov 6, 2025
1b07cd5
Enable unstyled light buttons when auto-using the windows11 style. (T…
martijnlaan Nov 6, 2025
077d20e
Add WizardBackImage and WizardBackImageDynamicDark directives.
martijnlaan Nov 6, 2025
0f7e98c
Fix for 46b819d6.
martijnlaan Nov 6, 2025
31598ef
Adjust clWindow/clBtnFace also if only BackColor is used.
martijnlaan Nov 6, 2025
225cda7
Automatically stop using built-in wizard images if a back image is sp…
martijnlaan Nov 6, 2025
b355bfd
Bevel tweaks.
martijnlaan Nov 6, 2025
244dddc
Improve hook.
martijnlaan Nov 6, 2025
b46eee1
Add smart WizardBackColor(DynamicDark) defaults.
martijnlaan Nov 6, 2025
3720a28
Cleanup.
martijnlaan Nov 6, 2025
8b2ab69
Merge branch 'main' into FormBackgroundStyleHook
martijnlaan Nov 10, 2025
9faad06
Merge branch 'main' into FormBackgroundStyleHook
martijnlaan Nov 10, 2025
7b322f5
Add transparency support to TNewCheckListBox when it's styled and in …
martijnlaan Nov 10, 2025
bc962e6
Improve scroll handling.
martijnlaan Nov 10, 2025
409407d
Whitespace / semicolon cleanup.
martijnlaan Nov 10, 2025
baf1000
Improve scroll handling some more.
martijnlaan Nov 10, 2025
5b4443e
Fix warning.
martijnlaan Nov 10, 2025
9c167b6
Merge branch 'main' into FormBackgroundStyleHook
martijnlaan Nov 12, 2025
297c0a4
Implement opacity handling for back image.
martijnlaan Nov 12, 2025
c36442e
Improve smart defaults from b46eee19.
martijnlaan Nov 12, 2025
10c97ff
Add separate WizardBackImageOpacity because sharing it with the regul…
martijnlaan Nov 12, 2025
d117466
Update more existing topics.
martijnlaan Nov 12, 2025
44bac2d
Add WizardBackImageFile sizes. Rest of topic todo later.
martijnlaan Nov 12, 2025
343772e
Merge branch 'main' into FormBackgroundStyleHook
martijnlaan Nov 13, 2025
91f47f2
Merge branch 'main' into FormBackgroundStyleHook
martijnlaan Nov 13, 2025
96c5907
Add documentation. Still have to double-check for typos and completen…
martijnlaan Nov 13, 2025
9e1e2ad
Merge branch 'main' into FormBackgroundStyleHook
martijnlaan Nov 13, 2025
9611501
Add more documentation + make clWindow as background color work better.
martijnlaan Nov 13, 2025
1ecc166
Fix typo (there will probably be more).
martijnlaan Nov 13, 2025
96efa2c
Add extra info.
martijnlaan Nov 13, 2025
9efaf29
Mini cleanup.
martijnlaan Nov 14, 2025
b1951c8
Add comment.
martijnlaan Nov 14, 2025
049e68a
Add WizardBackColor support to Uninstall. This requires a bump of Uni…
martijnlaan Nov 14, 2025
d5baa96
Merge branch 'main' into FormBackgroundStyleHook
martijnlaan Nov 14, 2025
8a3ccf9
Fix BeveledLabel custom back color.
martijnlaan Nov 14, 2025
5cdcf39
Clarify.
martijnlaan Nov 14, 2025
ee29143
Add extra info.
martijnlaan Nov 14, 2025
a674b48
Add example use cases.
martijnlaan Nov 14, 2025
d92ac33
Improve one of the examples.
martijnlaan Nov 14, 2025
711b420
Fix dynamic WizardBackColor support for Uninstall.
martijnlaan Nov 14, 2025
21a54e8
Merge branch 'main' into FormBackgroundStyleHook
martijnlaan Nov 14, 2025
948850c
Update whatsnew + fix typo in help.
martijnlaan Nov 14, 2025
958198e
Merge branch 'main' into FormBackgroundStyleHook
martijnlaan Nov 15, 2025
ea8b93c
Merge branch 'main' into FormBackgroundStyleHook
martijnlaan Nov 15, 2025
32c93bb
Merge branch 'main' into FormBackgroundStyleHook
martijnlaan Nov 15, 2025
1777ff5
Update for new directives.
martijnlaan Nov 15, 2025
afe15e0
Changing UninstallLogID will prevent Setup from appending to an exist…
martijnlaan Nov 15, 2025
1df6854
Merge branch 'main' into FormBackgroundStyleHook
martijnlaan Nov 15, 2025
1637c90
Add workaround for clBack vs TUninstallLogHeader.
martijnlaan Nov 15, 2025
face993
Update for MainPanel's ParentBackground being dynamic now.
martijnlaan Nov 15, 2025
bb7effe
Merge branch 'main' into FormBackgroundStyleHook
martijnlaan Nov 16, 2025
53230cd
Merge branch 'main' into FormBackgroundStyleHook
martijnlaan Nov 17, 2025
d2debe3
Merge branch 'main' into FormBackgroundStyleHook
martijnlaan Nov 18, 2025
c9e4e6e
Deal with clBack vs TUninstallLogHeader in the proper way.
martijnlaan Nov 18, 2025
da0b072
Merge branch 'main' into FormBackgroundStyleHook
martijnlaan Nov 18, 2025
8c76bbb
Up to 1054 on branch. Can/should be reverted if there's no release be…
martijnlaan Nov 18, 2025
b0323e1
Merge branch 'main' into FormBackgroundStyleHook
martijnlaan Nov 19, 2025
de1ee09
Merge branch 'main' into FormBackgroundStyleHook
martijnlaan Nov 19, 2025
f9dc122
Update.
martijnlaan Nov 19, 2025
c53c066
Merge branch 'main' into FormBackgroundStyleHook
martijnlaan Nov 19, 2025
a1121b0
Merge branch 'main' into FormBackgroundStyleHook
martijnlaan Nov 22, 2025
a4dcbec
Allow [Code] to update or remove the wizard background image (but not…
martijnlaan Nov 22, 2025
5c6c462
ROPS update for previous.
martijnlaan Nov 22, 2025
3e59a9c
Add WizardSetBackImage documentation & examples + finishing touches.
martijnlaan Nov 22, 2025
8c10e4c
Am I crazy or is WizardImageStretch=no help wrong? Unrelated to branc…
martijnlaan Nov 22, 2025
487e955
Tweak.
martijnlaan Nov 22, 2025
58a4c14
Whitespace.
martijnlaan Nov 23, 2025
50fd30e
Clarify.
martijnlaan Nov 23, 2025
6e42428
Merge branch 'main' into FormBackgroundStyleHook
martijnlaan Nov 24, 2025
eebe7ab
Merge branch 'main' into FormBackgroundStyleHook
martijnlaan Nov 24, 2025
084b526
Fix 6.6.1 release date
martijnlaan Nov 24, 2025
df006f0
Merge branch 'main' into FormBackgroundStyleHook
martijnlaan Nov 24, 2025
9458262
VCL Styles has this 'CN_CTLCOLORMSGBOX..CN_CTLCOLORSTATIC' check ever…
martijnlaan Nov 24, 2025
2e081df
Merge branch 'main' into FormBackgroundStyleHook
martijnlaan Nov 26, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 19 additions & 16 deletions Components/BitmapImage.pas
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ procedure TBitmapImageImplementation.Paint(const Sender: TObject; const Canvas:

var W, H: Integer;
var Bmp: TBitmap;
if Stretch then begin
if Stretch and not Bitmap.Empty then begin
W := R.Width;
H := R.Height;
Bmp := StretchedBitmap;
Expand Down Expand Up @@ -385,22 +385,25 @@ procedure TBitmapImageImplementation.Paint(const Sender: TObject; const Canvas:
Canvas.Rectangle(0, 0, FControl.Width, FControl.Height);
end;

var X := R.Left;
var Y := R.Top;
if Center then begin
Inc(X, (R.Width - W) div 2);
if X < 0 then
X := 0;
Inc(Y, (R.Height - H) div 2);
if Y < 0 then
Y := 0;
end;

if not Is32bit and (ReplaceColor <> clNone) and (ReplaceWithColor <> clNone) then begin
Canvas.Brush.Color := ReplaceWithColor;
Canvas.BrushCopy(Rect(X, Y, X + W, Y + H), Bmp, Rect(0, 0, Bmp.Width, Bmp.Height), ReplaceColor);
end else
Canvas.Draw(X, Y, Bmp);
if not Bitmap.Empty then begin
var X := R.Left;
var Y := R.Top;
if Center then begin
Inc(X, (R.Width - W) div 2);
if X < 0 then
X := 0;
Inc(Y, (R.Height - H) div 2);
if Y < 0 then
Y := 0;
end;

if not Is32bit and (ReplaceColor <> clNone) and (ReplaceWithColor <> clNone) then begin
Canvas.Brush.Color := ReplaceWithColor;
Canvas.BrushCopy(Rect(X, Y, X + W, Y + H), Bmp, Rect(0, 0, Bmp.Width, Bmp.Height), ReplaceColor);
end else
Canvas.Draw(X, Y, Bmp);
end;

if Assigned(OnPaint) then
OnPaint(Sender, Canvas, R);
Expand Down
97 changes: 97 additions & 0 deletions Components/FormBackgroundStyleHook.pas
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
unit FormBackgroundStyleHook;

{
Inno Setup
Copyright (C) 1997-2025 Jordan Russell
Portions by Martijn Laan
For conditions of distribution and use, see LICENSE.TXT.

Style hook for custom form backgrounds
}

interface

uses
Vcl.Forms, Vcl.Controls, Vcl.Graphics {$IFDEF VCLSTYLES}, BitmapImage {$ENDIF};

type
TFormBackgroundStyleHook = class(TFormStyleHook)
{$IFDEF VCLSTYLES}
private
class constructor Create;
class destructor Destroy;
class var FBitmapImageImpl: TBitmapImageImplementation;
class var FBitmapImageImplInitialized: Boolean;
class var FGraphic: TGraphic;
{$ENDIF}
class var FBackColor: TColor;
class var FGraphicTarget: TControl;
class procedure SetGraphic(Value: TGraphic); static;
{$IFDEF VCLSTYLES}
protected
procedure PaintBackground(Canvas: TCanvas); override;
{$ENDIF}
public
class property BackColor: TColor write FBackColor;
class property Graphic: TGraphic write SetGraphic;
class property GraphicTarget: TControl write FGraphicTarget;
end;

implementation

{$IFDEF VCLSTYLES}

uses
System.Classes, System.SysUtils;

{ TFormBackgroundStyleHook }

class constructor TFormBackgroundStyleHook.Create;
begin
FBackColor := clNone;
end;

class destructor TFormBackgroundStyleHook.Destroy;
begin
if FBitmapImageImplInitialized then
FBitmapImageImpl.DeInit;
FGraphic.Free;
end;

procedure TFormBackgroundStyleHook.PaintBackground(Canvas: TCanvas);
begin
var R := Rect(0, 0, Control.Width, Control.Height);

if (FGraphicTarget = Control) and (FBitmapImageImplInitialized or (FGraphic <> nil)) then begin
if not FBitmapImageImplInitialized then begin
FBitmapImageImpl.Init(Control);
FBitmapImageImpl.SetGraphic(FGraphic);
FreeAndNil(FGraphic);
FBitmapImageImplInitialized := True;
end;
FBitmapImageImpl.BackColor := FBackColor;
FBitmapImageImpl.Paint(Self, Canvas, R);
end else if FBackColor <> clNone then begin
Canvas.Brush.Color := FBackColor;
Canvas.FillRect(R);
end;
end;

{$ENDIF}

class procedure TFormBackgroundStyleHook.SetGraphic(Value: TGraphic);
begin
{$IFDEF VCLSTYLES}
if not FBitmapImageImplInitialized then begin
if FGraphic <> nil then
FreeAndNil(FGraphic);
if Value <> nil then begin
FGraphic := TGraphicClass(Value.ClassType).Create;
FGraphic.Assign(Value);
end;
end;
{$ENDIF}
end;


end.
2 changes: 2 additions & 0 deletions Components/NewNotebook.pas
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ TNewNotebook = class(TWinControl)
property DragMode;
property Enabled;
property Font;
property ParentBackground;
property ParentColor;
property ParentFont;
property ParentShowHint;
Expand Down Expand Up @@ -86,6 +87,7 @@ TNewNotebookPage = class(TCustomControl)
property Height stored False;
property Left stored False;
property PageIndex: Integer read GetPageIndex write SetPageIndex stored False;
property ParentBackground;
property ParentColor;
property ParentFont;
property ParentShowHint;
Expand Down
5 changes: 3 additions & 2 deletions Components/NewStaticText.pas
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,8 @@ procedure TNewStaticText.SetWordWrap(Value: Boolean);

{ TNewStaticTextStyleHook - same as Vcl.StdCtrls' TStaticTextStyleHook
except that it accesses the Control property as a TNewStaticText instead
of a TCustomStaticText or TStaticText }
of a TCustomStaticText or TStaticText, and that it uses the control's
Color property }

type
TControlAccess = class(TControl);
Expand Down Expand Up @@ -411,7 +412,7 @@ procedure TNewStaticTextStyleHook.Paint(Canvas: TCanvas);
LStyle.DrawParentBackground(Handle, Canvas.Handle, Details, False);
Canvas.Brush.Style := bsClear;
end else {$ENDIF} begin
Canvas.Brush.Color := LStyle.GetStyleColor(scWindow);
Canvas.Brush.Color := TNewStaticText(Control).Color;
Canvas.FillRect(R);
end;
Details := LStyle.GetElementDetails(States[Control.Enabled]);
Expand Down
3 changes: 2 additions & 1 deletion Projects/Setup.dpr
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ uses
Compression.SevenZipDLLDecoder.Interfaces in 'Src\Compression.SevenZipDLLDecoder.Interfaces.pas',
Shared.EncryptionFunc in 'Src\Shared.EncryptionFunc.pas',
UnsignedFunc in '..\Components\UnsignedFunc.pas',
Themes in '..\Components\Themes.pas';
Themes in '..\Components\Themes.pas',
FormBackgroundStyleHook in '..\Components\FormBackgroundStyleHook.pas';

{$I Src\Setup.inc}
1 change: 1 addition & 0 deletions Projects/Setup.dproj
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@
<DCCReference Include="Src\Shared.EncryptionFunc.pas"/>
<DCCReference Include="..\Components\UnsignedFunc.pas"/>
<DCCReference Include="..\Components\Themes.pas"/>
<DCCReference Include="..\Components\FormBackgroundStyleHook.pas"/>
<None Include="Src\Setup.inc"/>
<BuildConfiguration Include="Base">
<Key>Base</Key>
Expand Down
3 changes: 2 additions & 1 deletion Projects/SetupCustomStyle.dpr
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,8 @@ uses
UnsignedFunc in '..\Components\UnsignedFunc.pas',
Vcl.Themes,
Vcl.Styles,
Setup.TaskDialogForm in 'Src\Setup.TaskDialogForm.pas' {TaskDialogForm};
Setup.TaskDialogForm in 'Src\Setup.TaskDialogForm.pas' {TaskDialogForm},
FormBackgroundStyleHook in '..\Components\FormBackgroundStyleHook.pas';

{ The compiler may delete some of the resources included here }
{$R Res\Setup.icon.dark.res}
Expand Down
1 change: 1 addition & 0 deletions Projects/SetupCustomStyle.dproj
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@
<DCCReference Include="Src\Setup.TaskDialogForm.pas">
<Form>TaskDialogForm</Form>
</DCCReference>
<DCCReference Include="..\Components\FormBackgroundStyleHook.pas"/>
<None Include="Src\Setup.inc"/>
<BuildConfiguration Include="Base">
<Key>Base</Key>
Expand Down
40 changes: 32 additions & 8 deletions Projects/Src/Compiler.SetupCompiler.pas
Original file line number Diff line number Diff line change
Expand Up @@ -3312,6 +3312,20 @@ procedure TSetupCompiler.EnumSetupProc(const Line: PChar; const Ext: Integer);
ssWindowVisible: begin
WarningsList.Add(Format(SCompilerEntryObsolete, ['Setup', KeyName]));
end;
ssWizardBackColor: begin
try
SetupHeader.WizardBackColor := StringToColor(Value);
except
Invalid;
end;
end;
ssWizardBackColorDynamicDark: begin
try
SetupHeader.WizardBackColorDynamicDark := StringToColor(Value);
except
Invalid;
end;
end;
ssWizardImageAlphaFormat: begin
if CompareText(Value, 'none') = 0 then
SetupHeader.WizardImageAlphaFormat := afIgnored
Expand Down Expand Up @@ -7931,6 +7945,8 @@ procedure TSetupCompiler.Compile;
SetupHeader.WizardDarkStyle := wdsLight;
SetupHeader.WizardSizePercentX := 120;
SetupHeader.WizardSizePercentY := SetupHeader.WizardSizePercentX;
SetupHeader.WizardBackColor := clNone;
SetupHeader.WizardBackColorDynamicDark := clNone;

{ Read [Setup] section }
EnumIniSection(EnumSetupProc, 'Setup', 0, True, True, '', False, False);
Expand Down Expand Up @@ -8110,6 +8126,9 @@ procedure TSetupCompiler.Compile;
end;
if shAlwaysUsePersonalGroup in SetupHeader.Options then
UsedUserAreas.Add('AlwaysUsePersonalGroup');
if (SetupHeader.WizardBackColor <> clNone) or (SetupHeader.WizardBackColorDynamicDark <> clNone) then
if WizardStyleSpecial = '' then
WizardStyleSpecial := 'windows11';
if WizardStyleSpecial <> '' then begin
const BuiltinStyleFile = 'builtin:' + WizardStyleSpecial;
if WizardStyleFile = '' then
Expand Down Expand Up @@ -8186,7 +8205,7 @@ procedure TSetupCompiler.Compile;
WizardImages := CreateWizardImagesFromFiles('WizardImageFile', WizardImageFile);
if SetupDirectiveLines[ssWizardImageBackColor] = 0 then
SetupHeader.WizardImageBackColor := clWindow;
end else begin
end else if SetupDirectiveLines[ssWizardImageFile] = 0 then begin
WizardImages := CreateWizardImagesFromResources(['WizardImage'], ['150'], IsForcedDark);
if SetupDirectiveLines[ssWizardImageBackColor] = 0 then begin
{ The following colors were determined by using the ColorBlendRGB function to blend from the
Expand All @@ -8199,7 +8218,8 @@ procedure TSetupCompiler.Compile;
else
SetupHeader.WizardImageBackColor := IfThen(IsForcedDark, $3f3a2e, $f9f3e8); { Also see below }
end;
end;
end else if SetupDirectiveLines[ssWizardImageBackColor] = 0 then
SetupHeader.WizardImageBackColor := clNone;
LineNumber := SetupDirectiveLines[ssWizardSmallImageFile];
AddStatus(Format(SCompilerStatusReadingFile, ['WizardSmallImageFile']));
if WizardSmallImageFile <> '' then begin
Expand All @@ -8210,11 +8230,13 @@ procedure TSetupCompiler.Compile;
WizardSmallImages := CreateWizardImagesFromFiles('WizardSmallImage', WizardSmallImageFile);
if SetupDirectiveLines[ssWizardSmallImageBackColor] = 0 then
SetupHeader.WizardSmallImageBackColor := clWindow;
end else begin
end else if SetupDirectiveLines[ssWizardSmallImageFile] = 0 then begin
WizardSmallImages := CreateWizardImagesFromResources(['WizardSmallImage'], ['250'], IsForcedDark);
if SetupDirectiveLines[ssWizardSmallImageBackColor] = 0 then
SetupHeader.WizardSmallImageBackColor := clNone;
end;
end else if SetupDirectiveLines[ssWizardSmallImageBackColor] = 0 then
SetupHeader.WizardSmallImageBackColor := clNone;

LineNumber := 0;

{ Read dark dynamic wizard images }
Expand All @@ -8225,22 +8247,24 @@ procedure TSetupCompiler.Compile;
WizardImagesDynamicDark := CreateWizardImagesFromFiles('WizardImageFileDynamicDark', WizardImageFileDynamicDark);
if SetupDirectiveLines[ssWizardImageBackColorDynamicDark] = 0 then
SetupHeader.WizardImageBackColorDynamicDark := clWindow;
end else begin
end else if SetupDirectiveLines[ssWizardImageFileDynamicDark] = 0 then begin
WizardImagesDynamicDark := CreateWizardImagesFromResources(['WizardImage'], ['150'], True);
if SetupDirectiveLines[ssWizardImageBackColorDynamicDark] = 0 then
SetupHeader.WizardImageBackColorDynamicDark := $3f3a2e; { See above }
end;
end else if SetupDirectiveLines[ssWizardImageBackColorDynamicDark] = 0 then
SetupHeader.WizardImageBackColorDynamicDark := clNone;
LineNumber := SetupDirectiveLines[ssWizardSmallImageFileDynamicDark];
AddStatus(Format(SCompilerStatusReadingFile, ['WizardSmallImageFileDynamicDark']));
if WizardSmallImageFileDynamicDark <> '' then begin
WizardSmallImagesDynamicDark := CreateWizardImagesFromFiles('WizardSmallImageDynamicDark', WizardSmallImageFileDynamicDark);
if SetupDirectiveLines[ssWizardSmallImageBackColorDynamicDark] = 0 then
SetupHeader.WizardSmallImageBackColorDynamicDark := clWindow;
end else begin
end else if SetupDirectiveLines[ssWizardSmallImageFileDynamicDark] = 0 then begin
WizardSmallImagesDynamicDark := CreateWizardImagesFromResources(['WizardSmallImage'], ['250'], True);
if SetupDirectiveLines[ssWizardSmallImageBackColorDynamicDark] = 0 then
SetupHeader.WizardSmallImageBackColorDynamicDark := clNone;
end;
end else if SetupDirectiveLines[ssWizardSmallImageBackColorDynamicDark] = 0 then
SetupHeader.WizardSmallImageBackColorDynamicDark := clNone;
LineNumber := 0;
end;

Expand Down
15 changes: 11 additions & 4 deletions Projects/Src/Setup.MainFunc.pas
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,8 @@ interface
InstallMode: (imNormal, imSilent, imVerySilent);
HasIcons, IsWin64, Is64BitInstallMode, IsAdmin, IsPowerUserOrAdmin, IsAdminInstallMode,
NeedPassword, NeedSerial, NeedsRestart, RestartSystem, IsWinDark, IsDarkInstallMode,
IsUninstaller, AllowUninstallerShutdown, AcceptedQueryEndSessionInProgress: Boolean;
IsUninstaller, AllowUninstallerShutdown, AcceptedQueryEndSessionInProgress,
CustomWizardBackground: Boolean;
InstallDefaultDisableFsRedir, ScriptFuncDisableFsRedir: Boolean;
InstallDefaultRegView: TRegView = rvDefault;
HasCustomType, HasComponents, HasTasks: Boolean;
Expand Down Expand Up @@ -243,16 +244,16 @@ implementation

uses
ShellAPI, ShlObj, StrUtils, ActiveX, RegStr, Imaging.pngimage, Themes,
ChaCha20, ECDSA, ISSigFunc, BidiCtrls,
ChaCha20, ECDSA, ISSigFunc, BidiCtrls, PathFunc, FormBackgroundStyleHook,
SetupLdrAndSetup.Messages, Shared.SetupMessageIDs, Setup.DownloadFileFunc, Setup.ExtractFileFunc,
SetupLdrAndSetup.InstFunc, Setup.InstFunc, Setup.RedirFunc, PathFunc,
SetupLdrAndSetup.InstFunc, Setup.InstFunc, Setup.RedirFunc,
Compression.Base, Compression.Zlib, Compression.bzlib, Compression.LZMADecompressor,
Shared.SetupEntFunc, Shared.EncryptionFunc, Setup.SelectLanguageForm,
Setup.WizardForm, Setup.DebugClient, Shared.VerInfoFunc, Setup.FileExtractor,
Shared.FileClass, Setup.LoggingFunc, StringScanner,
SimpleExpression, Setup.Helper, Setup.SpawnClient, Setup.SpawnServer,
Setup.DotNetFunc, Shared.TaskDialogFunc, Setup.MainForm, Compression.SevenZipDecoder,
Compression.SevenZipDLLDecoder;
Compression.SevenZipDLLDecoder, Setup.SetupForm;

var
ShellFolders: array[Boolean, TShellFolderID] of String;
Expand Down Expand Up @@ -3327,6 +3328,7 @@ procedure InitializeSetup;
if IsDynamicDark then begin
SetupHeader.WizardImageBackColor := SetupHeader.WizardImageBackColorDynamicDark;
SetupHeader.WizardSmallImageBackColor := SetupHeader.WizardSmallImageBackColorDynamicDark;
SetupHeader.WizardBackColor := SetupHeader.WizardBackColorDynamicDark;
MainIconPostfix := '_DARK';
WantWizardImagesDynamicDark := True; { Handled below }
end;
Expand All @@ -3351,6 +3353,11 @@ procedure InitializeSetup;
TStyleManager.SetStyle(Handle);
if not IsDarkInstallMode and (shWizardLightButtonsUnstyled in SetupHeader.Options) then
TNewButton.DontStyle := True;
CustomWizardBackground := SetupHeader.WizardBackColor <> clNone;
if CustomWizardBackground then begin
TCustomStyleEngine.RegisterStyleHook(TSetupForm, TFormBackgroundStyleHook);
TFormBackgroundStyleHook.BackColor := SetupHeader.WizardBackColor;
end;
end;
end;

Expand Down
3 changes: 2 additions & 1 deletion Projects/Src/Setup.SelectLanguageForm.pas
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ constructor TSelectLanguageForm.Create(AOwner: TComponent);
begin
inherited;

MainPanel.ParentBackground := False;
if not CustomWizardBackground then
MainPanel.ParentBackground := False;

InitializeFont(False, True);

Expand Down
Loading