如何将VCL样式应用于在Inno安装程序中的基于DLL的表单? [英] How to apply VCL Styles to DLL-based forms in Inno Setup?
问题描述
我正在使用Inno Setup(Unicode)与一组我在Delphi XE2中编写的DLL。该DLL的VCL表单在安装向导/进度中显示。
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.
如何使这些DLL中的表单显示正确的样式? / p>
How can I make the forms in these DLL's show proper styles?
推荐答案
Inno Setup的VCL Styles插件仅用于在Inno Setup中的表单和控件上绘制样式。为了获取这些DLL中的表单,您需要从Inno安装程序可以在文件名中传递的DLL导出一个函数...
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设置
[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;
这篇关于如何将VCL样式应用于在Inno安装程序中的基于DLL的表单?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!