/*烟台大学计算机学院学生
*All right reserved.
*文件名称:C#——复选框(cheackedlistBox1)的体验添加
*作者:杨飞
*完成日期:2014年9月2日
*版本号:v1.0
*对任务及求解方法的描述部分:C#——复选框(cheackedlistBox1)的体验添加
*我的程序:*/
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
checkedListBox1.Items.Add("语文");
checkedListBox1.Items.Add("英语");
checkedListBox1.Items.Add("数学");
checkedListBox1.Items.Add("体育");
checkedListBox1.SelectedIndex = 0;
}
private void checkedListBox1_SelectedIndexChanged(object sender, EventArgs e)
{
label1.Text = checkedListBox1.GetItemCheckState(checkedListBox1.SelectedIndex) ==
CheckState.Checked ? checkedListBox1.Text : string.Empty;
}
}
}
运行结果:
心得体会:无