如何处理 Windows 安装程序中的复选框控件? [英] How to handle checkbox controls in windows installer?

查看:19
本文介绍了如何处理 Windows 安装程序中的复选框控件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Visual Studio 2008 创建一个安装项目.我想创建一个文件,其中包含用户在安装过程中选择的复选框的值.如何以及在哪里编写相同的代码?我是 Windows 安装程序的新手.请为我提供相同的指示.提前致谢.

I am using Visual Studio 2008 to create a setup project. I want to create a file which will contain values of the checkboxes which are selected by user during installation. How and where to write the code for the same? I am new to windows installer. Please provide me pointers for the same. Thank you in advance.

推荐答案

您可以使用安装程序类轻松完成.

You can easily do it with installer class.

  1. 首先将安装程序类添加到您的安装项目中.转到添加 >添加新项目 > 选择安装程序类

  1. 创建一个带有单选按钮的窗口窗体以获取用户输入和逻辑以将所选值保存到文本文件中.

  1. Create a Window Form with radio button to get user input and logic to save selected values to a text file.

在安装程序类的 Install 方法中,打开 Windows 窗体以获取用户输入.所以在安装过程中会弹出窗口表单,用户可以在其中选择值.(请注意,此表单不会作为模态弹出窗口打开)

Within installer class`s Install method open windows form to get the user input. So during the installation windows form will pop up where user can select the values.(Please not that this form will not open as a modal pop up)

Install()

 public override void Install(IDictionary stateSaver)
        {
            base.Install(stateSaver);

            Form1 form = new Form1();
            form.ShowDialog();
        }

最佳方法

在安装过程中获取用户输入的最佳方法是创建 .wid 文件.请参阅我的帖子 此处.

Best approach to get the user input during the installation is to create .wid file. See my post here.

这篇关于如何处理 Windows 安装程序中的复选框控件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆