inno-setup - Inno Setup - 更改 PageNameLabel / PageDescriptionLabel 字体参数(颜色、大小)
问题描述
所以我在我的 .iss 文件中得到了这个:
[Files]
Source: "WizModernImageTop2.bmp"; Flags: dontcopy
[Code]
function CloneStaticTextToLabel(StaticText: TNewStaticText): TLabel;
begin
Result := TLabel.Create(WizardForm);
Result.Parent := StaticText.Parent;
Result.Left := StaticText.Left;
Result.Top := StaticText.Top;
Result.Width := StaticText.Width;
Result.Height := StaticText.Height;
Result.AutoSize := StaticText.AutoSize;
Result.ShowAccelChar := StaticText.ShowAccelChar;
Result.WordWrap := StaticText.WordWrap;
Result.Font := StaticText.Font;
StaticText.Visible := False;
WizardForm.PageDescriptionLabel.Font.Color := clRed;
WizardForm.PageNameLabel.Font.Color := clRed;
end;
var
PageDescriptionLabel: TLabel;
PageNameLabel: TLabel;
procedure InitializeWizard;
var
BitmapImage: TBitmapImage;
begin
ExtractTemporaryFile('WizModernImageTop2.bmp');
BitmapImage := TBitmapImage.Create(WizardForm);
BitmapImage.Parent := WizardForm.MainPanel;
BitmapImage.Width := WizardForm.MainPanel.Width;
BitmapImage.Height := WizardForm.MainPanel.Height;
BitmapImage.Stretch := True;
BitmapImage.AutoSize := False;
BitmapImage.Bitmap.LoadFromFile(ExpandConstant('{tmp}\WizModernImageTop2.bmp'));
WizardForm.WizardSmallBitmapImage.Visible := True;
WizardForm.PageDescriptionLabel.Visible := True;
WizardForm.PageNameLabel.Visible := True;
{ Create TLabel equivalent of standard TNewStaticText components }
PageNameLabel := CloneStaticTextToLabel(WizardForm.PageNameLabel);
PageDescriptionLabel := CloneStaticTextToLabel(WizardForm.PageDescriptionLabel);
end;
procedure CurPageChanged(CurPageID: Integer);
begin
{ Update the custom TLabel components from the standard hidden components }
PageDescriptionLabel.Caption := WizardForm.PageDescriptionLabel.Caption;
PageNameLabel.Caption := WizardForm.PageNameLabel.Caption;
end;
我想要达到的目标:
将 PageNameLabel 和 PageDescriptionLabel 的颜色/大小(在需要时)更改为白色,以便可见。现在是黑底黑字。我不知道 WizardForm 元素的字体参数,嗯...
更新:如果有人愿意在他的安装程序中使用图像而不是在右侧显示小 WizardSmallImage 图标,请使用上面提供的代码,这样标签就会显示在启用透明度的图像顶部。它需要 Unicode 版本的 Inno 才能工作。
解决方案
用于TNewStaticText.Font.Color
更改标签颜色。
WizardForm.PageDescriptionLabel.Font.Color := clWhite;
WizardForm.PageNameLabel.Font.Color := clWhite;
推荐阅读
- css - CSS改变反应MUI选择
- algorithm - 树证书中的子序列是否保证它包含给定的树?
- c# - 无法使用具有应用程序权限的 Microsoft Graph 获取用户信息
- c - 即使条件为假,while循环也会继续运行
- asp.net-core - NetCore 3.1 PostAsync CustomHeaders 不工作
- reactjs - 没有找到匹配的文件...。(反应JS)
- mysql - 如何远程或通过 IP 地址连接到 mariaDB?
- python - 多个字符串输入 - Python
- javascript - javascript:按数字和字母顺序对数组进行排序
- python - Pyaudio:如何在单独的进程(多处理)中播放 wav 文件?