Google
      
发新话题
打印

如何做到点击某个组件后显示文字描述和图像

如何做到点击某个组件后显示文字描述和图像

如何做到点击某个组件后显示文字描述和图像来自汉化新世纪  gnatix

[Setup]
AppName=My Program
AppVerName=My Program version 1.5
DefaultDirName={pf}\My Program
DefaultGroupName=My Program
UninstallDisplayIcon={app}\MyProg.exe

[Components]
Name: "program"; Description: "程序文件"; Types: full compact custom; Flags: fixed
Name: "help"; Description: "帮助文件"; Types: full
Name: "readme"; Description: "自述文件"; Types: full
Name: "readme\en"; Description: "英文"; Flags: exclusive
Name: "readme\de"; Description: "德文"; Flags: exclusive

[Files]
Source: "MyProg.exe"; DestDir: "{app}"; Components: program
Source: "MyProg.chm"; DestDir: "{app}"; Components: help
Source: "Readme.txt"; DestDir: "{app}"; Components: readme\en; Flags: isreadme
Source: "Readme-German.txt"; DestName: "Liesmich.txt"; DestDir: "{app}"; Components: readme\de; Flags: isreadme
; 组件描述图片文件
Source: "image0.bmp"; Flags: dontcopy
Source: "image1.bmp"; Flags: dontcopy
Source: "image2.bmp"; Flags: dontcopy
Source: "image3.bmp"; Flags: dontcopy
Source: "image4.bmp"; Flags: dontcopy

[Icons]
Name: "{group}\My Program"; Filename: "{app}\MyProg.exe"

[Code]
var
Bmp: TBitmapImage;
Info: TNewStaticText;

procedure CompListOnClick(Sender: TObject);
begin
// 点击组件列表后的反应
Bmp.Stretch:= true;
if WizardForm.ComponentsList.Selected[0] then
begin
info.Caption:= '这是组件 1,必需安装。';
bmp.Bitmap.LoadFromFile(ExpandConstant('{tmp}\image0.bmp'));
end;
if WizardForm.ComponentsList.Selected[1] then
begin
info.Caption:= '这是组件 2,随便您。';
bmp.Bitmap.LoadFromFile(ExpandConstant('{tmp}\image1.bmp'));
end;
if WizardForm.ComponentsList.Selected[2] then
begin
info.Caption:= '这是组件 3,看着办吧。';
bmp.Bitmap.LoadFromFile(ExpandConstant('{tmp}\image2.bmp'));
end;
if WizardForm.ComponentsList.Selected[3] then
begin
info.Caption:= '这是组件 4,可有可无。';
bmp.Bitmap.LoadFromFile(ExpandConstant('{tmp}\image3.bmp'));
end;
if WizardForm.ComponentsList.Selected[4] then
begin
info.Caption:= '这是组件 5,没得说,好东西。';
bmp.Bitmap.LoadFromFile(ExpandConstant('{tmp}\image4.bmp'));
end;
end;

procedure InitializeWizard();
begin
// 释放图像文件
ExtractTemporaryFile('image0.bmp');
ExtractTemporaryFile('image1.bmp');
ExtractTemporaryFile('image2.bmp');
ExtractTemporaryFile('image3.bmp');
ExtractTemporaryFile('image4.bmp');
// 调整组件列表的大小
WizardForm.TYPESCOMBO.Visible:= false;
WizardForm.ComponentsList.Height := WizardForm.ComponentsList.Height + WizardForm.ComponentsList.Top - WizardForm.TYPESCOMBO.Top;
WizardForm.ComponentsList.Top := WizardForm.TYPESCOMBO.Top;
WizardForm.ComponentsList.Width := ScaleX(200);
WizardForm.ComponentsList.OnClick:= @CompListOnClick;
// 创建描述位图
Bmp:= TBitmapImage.Create(WizardForm);
Bmp.Top:=WizardForm.ComponentsList.Top;
Bmp.Left:=ScaleX(220);
Bmp.Width:=ScaleX(200);
Bmp.Height:=ScaleY(140);
Bmp.BackColor:= WizardForm.Color;
Bmp.Parent:= WizardForm.SelectComponentsPage;
// 创建描述文字
Info:= TNewStaticText.Create(WizardForm);
Info.Top:= Bmp.Top + ScaleY(160);
Info.Left:= Bmp.Left + ScaleX(10);
Info.Width:= ScaleX(200);
Info.Height:= ScaleY(25);
Info.Caption:= '把光标放到某个组件可显示说明...';
Info.Font.Color:= clRed;
Info.Parent:= WizardForm.SelectComponentsPage;
end;


示例安装程序:
http://gnatix.hanzify.org/setup_components.rar
附件: 您所在的用户组无法下载或查看附件
好不容易忙完,现在总算有点时间了。不能及时回答大家的问题,还请大家多多包函。
勇于思考,敢于行动,不逃避问题。
业务联系:dvd制作,各种系统、平面广告设计、3D设计,电脑专业维修,网络组建,MTV个人像册、视频处理!
电话:13423195467

TOP

发新话题