将图像添加到 Inno Setup 组件列表 - 组件描述

问题描述 投票:0回答:1

当用户将鼠标光标悬停在“选择组件”页面上的组件上时,我想显示一个小图像。

例如,我想做这样的事情:

enter image description here

我在这里找到了一半的解决方案:

Inno Setup 组件的长描述

但是我缺少图像部分。

inno-setup pascalscript
1个回答
2
投票
基于

我对Inno Setup 组件的详细描述的回答。您需要复制 HoverTimerProc 及其支持函数和全局变量。


此答案修改了

HoverComponentChanged

InitializeWizard
程序以支持除描述标签之外的图像。

[Files] ... Source: Main.bmp; Flags: dontcopy Source: Additional.bmp; Flags: dontcopy Source: Help.bmp; Flags: dontcopy [Code] var CompLabel: TLabel; CompImage: TBitmapImage; LoadingImage: Boolean; procedure HoverComponentChanged(Index: Integer); var Description: string; Image: string; ImagePath: string; begin case Index of 0: begin Description := 'This is the description of Main Files'; Image := 'main.bmp'; end; 1: begin Description := 'This is the description of Additional Files'; Image := 'additional.bmp'; end; 2: begin Description := 'This is the description of Help Files'; Image := 'help.bmp'; end; else Description := 'Move your mouse over a component to see its description.'; end; CompLabel.Caption := Description; if Image <> '' then begin { The ExtractTemporaryFile pumps the message queue, prevent recursion } if not LoadingImage then begin LoadingImage := True; try ImagePath := ExpandConstant('{tmp}\' + Image); if not FileExists(ImagePath) then begin ExtractTemporaryFile(Image); end; CompImage.Bitmap.LoadFromFile(ImagePath); finally LoadingImage := False; end; end; CompImage.Visible := True; end else begin CompImage.Visible := False; end; end; procedure InitializeWizard(); var HoverTimerCallback: LongWord; begin { For HoverTimerProc and its supporting functions, } { see https://stackoverflow.com/q/10867087/850848#37796528 } HoverTimerCallback := WrapTimerProc(@HoverTimerProc, 4); SetTimer(0, 0, 50, HoverTimerCallback); CompLabel := TLabel.Create(WizardForm); CompLabel.Parent := WizardForm.SelectComponentsPage; CompLabel.Left := WizardForm.ComponentsList.Left; CompLabel.Width := (WizardForm.ComponentsList.Width - ScaleX(16)) div 2; CompLabel.Height := ScaleY(64); CompLabel.Top := WizardForm.ComponentsList.Top + WizardForm.ComponentsList.Height - CompLabel.Height; CompLabel.AutoSize := False; CompLabel.WordWrap := True; CompImage := TBitmapImage.Create(WizardForm); CompImage.Parent := WizardForm.SelectComponentsPage; CompImage.Top := CompLabel.Top; CompImage.Width := CompImage.Width; CompImage.Height := CompLabel.Height; CompImage.Left := WizardForm.ComponentsList.Left + WizardForm.ComponentsList.Width - CompLabel.Width; WizardForm.ComponentsList.Height := WizardForm.ComponentsList.Height - CompLabel.Height - ScaleY(8); end;

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.