杉宫竹苑工作室

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 2031|回复: 0

Inno Setup点击组件显示描述和图像

[复制链接]
发表于 2017-2-26 14:20:43 | 显示全部楼层 |阅读模式

正式会员享受无限制浏览网站功能和高速网盘下载,赶快加入本站吧!

您需要 登录 才可以下载或查看,没有账号?立即注册

x
  1. [Setup]
  2. AppName=My Program
  3. AppVerName=My Program version 1.5
  4. DefaultDirName={pf}\My Program
  5. DefaultGroupName=My Program
  6. UninstallDisplayIcon={app}\MyProg.exe

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

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

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

  26. [Code]
  27. var
  28.   Bmp: TBitmapImage;
  29.   Info: TNewStaticText;

  30. procedure CompListOnClick(Sender: TObject);
  31. begin
  32. // 点击组件列表后的反应
  33. Bmp.Stretch:= true;
  34. if WizardForm.ComponentsList.Selected[0] then
  35.   begin
  36.   info.Caption:= '这是组件 1,必需安装。';
  37.   bmp.Bitmap.LoadFromFile(ExpandConstant('{tmp}\image0.bmp'));
  38.   end;
  39. if WizardForm.ComponentsList.Selected[1] then
  40.   begin
  41.   info.Caption:= '这是组件 2,随便您。';
  42.   bmp.Bitmap.LoadFromFile(ExpandConstant('{tmp}\image1.bmp'));
  43.   end;
  44. if WizardForm.ComponentsList.Selected[2] then
  45.   begin
  46.   info.Caption:= '这是组件 3,看着办吧。';
  47.   bmp.Bitmap.LoadFromFile(ExpandConstant('{tmp}\image2.bmp'));
  48.   end;
  49. if WizardForm.ComponentsList.Selected[3] then
  50.   begin
  51.   info.Caption:= '这是组件 4,可有可无。';
  52.   bmp.Bitmap.LoadFromFile(ExpandConstant('{tmp}\image3.bmp'));
  53.   end;
  54. if WizardForm.ComponentsList.Selected[4] then
  55.   begin
  56.   info.Caption:= '这是组件 5,没得说,好东西。';
  57.   bmp.Bitmap.LoadFromFile(ExpandConstant('{tmp}\image4.bmp'));
  58.   end;
  59. end;

  60. procedure InitializeWizard();
  61. begin
  62.   // 释放图像文件
  63.   ExtractTemporaryFile('image0.bmp');
  64.   ExtractTemporaryFile('image1.bmp');
  65.   ExtractTemporaryFile('image2.bmp');
  66.   ExtractTemporaryFile('image3.bmp');
  67.   ExtractTemporaryFile('image4.bmp');
  68.   // 调整组件列表的大小
  69.   WizardForm.TYPESCOMBO.Visible:= false;
  70.   WizardForm.ComponentsList.Height := WizardForm.ComponentsList.Height + WizardForm.ComponentsList.Top - WizardForm.TYPESCOMBO.Top;
  71.   WizardForm.ComponentsList.Top := WizardForm.TYPESCOMBO.Top;
  72.   WizardForm.ComponentsList.Width := ScaleX(200);
  73.   WizardForm.ComponentsList.OnClick:= @CompListOnClick;
  74.   // 创建描述位图
  75.   Bmp:= TBitmapImage.Create(WizardForm);
  76.   Bmp.Top:=WizardForm.ComponentsList.Top;
  77.   Bmp.Left:=ScaleX(220);
  78.   Bmp.Width:=ScaleX(200);
  79.   Bmp.Height:=ScaleY(140);
  80.   Bmp.BackColor:= WizardForm.Color;
  81.   Bmp.Parent:= WizardForm.SelectComponentsPage;
  82.   // 创建描述文字
  83.   Info:= TNewStaticText.Create(WizardForm);
  84.   Info.Top:= Bmp.Top + ScaleY(160);
  85.   Info.Left:= Bmp.Left + ScaleX(10);
  86.   Info.Width:= ScaleX(200);
  87.   Info.Height:= ScaleY(25);
  88.   Info.Caption:= '把光标放到某个组件可显示说明...';
  89.   Info.Font.Color:= clRed;
  90.   Info.Parent:= WizardForm.SelectComponentsPage;
  91. end;
复制代码


回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|小黑屋|手机版|Archiver|SgzyStudio

GMT+8, 2024-5-19 13:10 , Processed in 0.102124 second(s), 18 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表