问题
I'm using Inno Setup (Unicode) with a set of DLL's that I'm writing in Delphi XE2. The DLL's have VCL forms which are shown during the installation wizard/progress.
I've tried out implementing VCL Styles in my Inno Setup installer. All is well, except for the forms which are created within these DLL's. Some of the form is skinned, but not all of it...
As you can see, the form's background color, the list view background color, and the font color have changed. However, the list view headers, the progress bars, and the form's border are still the old style.
How can I make the forms in these DLL's show proper styles?
回答1:
The VCL Styles plugin for Inno Setup is only designed to draw styles on the forms and controls in Inno Setup. In order to get the forms in these DLL's to be skinned, you need to export a function from the DLL that Inno Setup can pass in the filename...
Inno Setup
[Code]
#define public VclStyleFile "Carbon (2).vsf"
procedure DllLoadStyle(const StyleFilename: WideString);
external 'DllLoadStyle@MyDLL.dll stdcall';
function InitializeSetup: Boolean;
begin
ExtractTemporaryFile('{#VclStyleFile}');
LoadVCLStyleW(ExpandConstant('{tmp}\{#VclStyleFile}'));
DllInit; //Presumed your DLL needs to initialize / instantiate the form
DllLoadStyle(ExpandConstant('{tmp}\{#VclStyleFile}'));
...
end;
Delphi DLL
uses
Vcl.Themes,
procedure DllLoadStyle(const StyleFilename: WideString); stdcall;
begin
TStyleManager.SetStyle(TStyleManager.LoadFromFile(StyleFilename))
end;
exports
DllLoadStyle;
来源:https://stackoverflow.com/questions/21805807/how-to-apply-vcl-styles-to-dll-based-forms-in-inno-setup