Inno Setup如何创建一个向导界面

Inno Setup如何创建一个向导界面

以下为一个简单的rudio单选界面的代码

var
Page: TWizardPage;
RadioButton1, RadioButton2: TRadioButton;
Lbl1, Lbl2: TNewStaticText;

procedure CreatePage;
begin
Page := CreateCustomPage(wpInfoBefore, '向导页主标题', '向导页辅助标题');

RadioButton1 := TRadioButton.Create(Page);
RadioButton1.Left := ScaleX(100);
RadioButton1.Top := ScaleY(48);
RadioButton1.Width := Page.SurfaceWidth;
RadioButton1.Height := ScaleY(18);
RadioButton1.Caption := '选项一';
RadioButton1.Checked := True;
RadioButton1.Parent := Page.Surface;
RadioButton1.OnClick := @RadioButtonClick;

Lbl1 := TNewStaticText.Create(Page);
Lbl1.Left := ScaleX(115);
Lbl1.Top := ScaleY(68);
Lbl1.Width := ScaleX(250);
Lbl1.Height := ScaleY(50);
Lbl1.Caption := '选项一的具体信息';
Lbl1.Parent := Page.Surface;

RadioButton2 := TRadioButton.Create(Page);
RadioButton2.Left := ScaleX(100);
RadioButton2.Top := RadioButton1.Top + ScaleY(68);
RadioButton2.Width := Page.SurfaceWidth;
RadioButton2.Height := ScaleY(18);
RadioButton2.Caption := '选项二';
RadioButton2.Checked := false;
RadioButton2.Parent := Page.Surface;
RadioButton2.OnClick := @RadioButtonClick;

Lbl2 := TNewStaticText.Create(Page);
Lbl2.Left := ScaleX(115);
Lbl2.Top := Lbl1.Top + ScaleY(68);
Lbl2.Width := ScaleX(250);
Lbl2.Height := ScaleY(50);
Lbl2.Caption := '选项二的具体信息';
Lbl2.Parent := Page.Surface;
end;

procedure InitializeWizard();
begin
CreatePage;
end;

创建这个向导界面有以下几个关键点

1. 声明一个名称为Page的页面
var
Page: TWizardPage;
2. 声明创建页面的程序,在进程中创建页面
procedure CreatePage;
3. 创建页面并赋值给Page
Page := CreateCustomPage(wpWelcome, ‘向导页主标题’, ‘向导页辅助标题’);
其它的都是页面元素的具体声明与描述,这个需要根据个人需要定制。
4. CreateCustomPage(const AfterID: Integer; const ACaption, ADescription: String): TwizardPage
CreateCustomPage函数为创建一个自定义的页面,第一个参数为页面ID,表示我们的页面要在这个ID的页面之后出现,系统里面有一些预订的页面ID,wpWelcome,wpLicense,wpPassword,wpInfoBefore,wpUserInfo,wpSelectDir,wpSelectComponents,wpSelectProgramGroup,wpSelectTasks,wpReady,wpPreparing,wpInstalling,wpInfoAfter,wpFinished,根据自己需求放置我们的页面。
5. 创建页面程序写完后一定要放入初始化向导页程序中,InitializeWizard为系统进程,用于在开始的时候改变向导或向导页,我们创建页面的进程需要放入里面执行。
procedure InitializeWizard();
begin
CreatePage;
end;

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值