Presentation is loading. Please wait.

Presentation is loading. Please wait.

第四讲 客户问卷调查程序 教育部“十二五”职业教育国家规划教材

Similar presentations


Presentation on theme: "第四讲 客户问卷调查程序 教育部“十二五”职业教育国家规划教材"— Presentation transcript:

1 第四讲 客户问卷调查程序 教育部“十二五”职业教育国家规划教材
《Visual C#程序设计与软件项目实训》电子工业出版社 郑伟 谭恒松 编著 ISBN: 教材网站: 第四讲 客户问卷调查程序

2 目录 任务:熟悉常用控件的使用 任务:设计客户问卷调查程序 任务:功能拓展

3 任务:熟悉常用控件的使用 RadioButton控件 CheckBox控件 ListBox控件 ComboBox控件 GroupBox控件

4 RadioButton控件 RadioButton是单选按钮控件,多个RadioButton控件可以为一组,这一组内的RadioButton控件只能有一个被选中,即按钮之间相互制约。

5 RadioButton控件 private void btnOK_Click(object sender, EventArgs e) {
if (radioButton1.Checked == true) MessageBox.Show("您的性别为:" + radioButton1.Text); } if (radioButton2.Checked == true) MessageBox.Show("您的性别为:" + radioButton2.Text);

6 CheckBox控件 CheckBox控件通常称为复选框,主要用于多项选择。

7 CheckBox控件 private void btnOK_Click(object sender, EventArgs e) {
string info = ""; if (checkBox1.Checked == true) info = checkBox1.Text; } if (checkBox2.Checked == true) info = info + checkBox2.Text; if (checkBox3.Checked == true) info = info + checkBox3.Text; if (checkBox4.Checked == true) info = info + checkBox4.Text; MessageBox.Show("您对业务员总体印象为:"+info);

8 ListBox控件 ListBox控件通常称为列表框控件,主要用于展示下拉列表。

9 ListBox控件 //左边列表框选择项移动到右边列表框
listBox2.Items.Add(listBox1.SelectedItem); listBox1.Items.Remove(listBox1.SelectedItem); //左边所有项移动到右边 listBox2.Items.AddRange(listBox1.Items); listBox1.Items.Clear();

10 ComboBox控件 控件ComboBox中有一个文本框,可以在文本框输入字符,其右侧有一个向下的箭头,单击此箭头可以打开一个列表框,可以从列表框选择希望输入的内容,通常称为组合框控件。

11 GroupBox控件 GroupBox 控件用于为其他控件提供可识别的分组。

12 任务:设计客户问卷调查程序

13 任务:设计客户问卷调查程序 –代码 private void btnOK_Click(object sender, EventArgs e)
{ string answers = ""; if(rbtnAnswer1.Checked==true) answers = "客户性别:" + rbtnAnswer1.Text; } if (rbtnAnswer2.Checked == true) answers = "客户性别:" + rbtnAnswer2.Text; if(chkAnswer1.Checked==true) answers = answers + "\r\n" + "客户对业务员印象: " + chkAnswer1.Text;

14 任务:设计客户问卷调查程序 –代码 if (chkAnswer2.Checked == true) {
answers = answers + chkAnswer2.Text; } if (chkAnswer3.Checked == true) answers = answers + chkAnswer3.Text; if (chkAnswer4.Checked == true) answers = answers + chkAnswer4.Text;

15 任务:设计客户问卷调查程序 –代码 MessageBox.Show(answers + "\r\n" + "客户需要: " + lstAnswer.SelectedItem.ToString() + "\r\n" + "客户最满意: " + cboAnswer.Text ,"问卷调查结果"); }

16 项目总结 本项目主要涉及的控件: (1)RadioButton控件; (2)CheckBox控件; (3)ListBox控件;
(4)ComboBox控件; (5)GroupBox控件。

17 功能拓展 客户问卷调查程序较为简单,读者可以根据学习情况,对客户问卷调查程序进行功能拓展。 (1)需要判断列表框是否选中选项,请拓展代码;
(2)需要判断组合框是否选中选项,请拓展代码; (3)读者可以根据本项目设计制作的方法,设计制作一个关于汽车文化的问卷调查程序。

18 THANK YOU


Download ppt "第四讲 客户问卷调查程序 教育部“十二五”职业教育国家规划教材"

Similar presentations


Ads by Google