zoukankan      html  css  js  c++  java
  • Inno Setup技巧[实例]添加自定义页面

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

    在[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值,蓝色部分分别表示自定义页面的标题和描述。

    默认截图:

    自定义截图:

    转自:http://hi.baidu.com/watashi/item/b3dda993459ff8f0291647a0

  • 相关阅读:
    如何阅读修改代码
    C C++ TDD单元测试非常好的书
    应用代理 socket TCP协议 的资料
    闲聊桌面应用开发[Win16->Win32->ATL/WTL/MFC->WinForm->WPF/Silverlight/WinRT]
    MySQL sharding的几个参考地址
    ubuntu环境变量
    Angular JS | Closure | Google Web Toolkit | Dart | Polymer 概要汇集
    Linux下的应用程序性能分析 总结
    ubuntu处理中文时设置locale
    Tomcat https自制证书和浏览器配置
  • 原文地址:https://www.cnblogs.com/xiurui12345/p/3091175.html
Copyright © 2011-2022 走看看