Inno Setup技巧[实例]添加自定义页面

原文 http://hi.baidu.com/watashi/item/b3dda993459ff8f0291647a0

通过“添加自定义页面”可以丰富安装程序的功能。本文以添加一个页面“选择安装类型”为例,选择标准安装将跳过“选择目标位置”和“选择开始菜单文件夹”两个页面。

在[Code]段添加以下代码:

复制代码
var
Page: TWizardPage;

RadioButton1, RadioButton2: TRadioButton;
Lbl1, Lbl2: TNewStaticText;


procedure CreateAddonPage;
begin
Page := CreateCustomPage(wpInfoBefore, '选择安装类型', '请根据您的需要选择安装的类型');

RadioButton1 := TRadioButton.Create(Page);
RadioButton1.Left := ScaleX(80);
RadioButton1.Top := ScaleY(40);
RadioButton1.Width := Page.SurfaceWidth;
RadioButton1.Height := ScaleY(17);
RadioButton1.Caption := '标准安装';
RadioButton1.Checked := True;
RadioButton1.Parent := Page.Surface;

Lbl1 := TNewStaticText.Create(Page);
Lbl1.Left := ScaleX(95);
Lbl1.Top := ScaleY(60);
Lbl1.Width := ScaleX(250);
Lbl1.Height := ScaleY(50);
Lbl1.Caption := '按照标准模式安装软件到您的电脑';
Lbl1.Parent := Page.Surface;

RadioButton2 := TRadioButton.Create(Page);
RadioButton2.Left := ScaleX(80);
RadioButton2.Top := RadioButton1.Top + ScaleY(60);
RadioButton2.Width := Page.SurfaceWidth;
RadioButton2.Height := ScaleY(17);
RadioButton2.Caption := '自定义安装';
RadioButton2.Checked := false;
RadioButton2.Parent := Page.Surface;

 

Lbl2 := TNewStaticText.Create(Page);
Lbl2.Left := ScaleX(95);
Lbl2.Top := Lbl1.Top + ScaleY(60);
Lbl2.Width := ScaleX(250);
Lbl2.Height := ScaleY(50);
Lbl2.Caption := '您可以选择单个安装项,建议经验丰富的用户使用';
Lbl2.Parent := Page.Surface;
end;

procedure InitializeWizard();
begin
CreateAddonPage;

end;

function ShouldSkipPage(PageID: Integer): Boolean;
begin
if (PageID = wpSelectDir) and (RadioButton1.Checked) then
Result := True
else if (PageID = wpSelectProgramGroup) and (RadioButton1.Checked) then
Result := True
end;
复制代码

 

代码中红色部分表示自定义页面所紧跟的向导页面的CurPageID值,蓝色部分分别表示自定义页面的标题和描述。

 

默认截图:

自定义截图:

posted on 2013-08-03 00:18 NET未来之路 阅读( ...) 评论( ...) 编辑 收藏

转载于:https://www.cnblogs.com/lonelyxmas/p/3234060.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值