电脑桌面
添加小米粒文库到电脑桌面
安装后可以在桌面快捷访问

ChecklistBox

ChecklistBox_第1页
1/13
ChecklistBox_第2页
2/13
ChecklistBox_第3页
3/13
二、CheckBox 控件 1.功能 CheckBox 控件指定某个特定条件是处于打开状态还是处于关闭状态,它常用于为用户提供“是/否”或“真/假”选项。 2.属性 CheckBox 控件常用属性及说明如表所示。 if (this.checkBox1.Checked == False && this.checkBox2.Checked ==False && checkBox3.Checked == False) { MessageBox.Show("至少选一项爱好"); return; } if (radioButton1.Checked == False && radioButton2.Checked == False) { MessageBox.Show("请选择性别"); return; } 八、Listbox 和 CheckedListbox 显示一个 ListBox,其中在每项的左边显示一个复选框。 命名空间: System.Windows.Forms public partial class Form3 : Form { public Form3() //将文本框中的内容添加到listbox中 { InitializeComponent(); textBox1.Text = "请输入添加的项目"; } private void button1_Click(object sender, EventArgs e) { listBox1.Items.Add(textBox1.Text); textBox1.Text = ""; } private void button2_Click(object sender, EventArgs e) { listBox1.Items.Remove(listBox1.Text); } private void button3_Click(object sender, EventArgs e) { listBox1.Items.Clear(); } } // Moves the checked items from the CheckedListBox to the listBox. private void button2_Click(object sender, System.EventArgs e) { listBox1.Items.Clear(); button3.Enabled=false ; for (int i=0; i< checkedListBox1.CheckedItems.Count;i++) { listBox1.Items.Add(checkedListBox1.CheckedItems[i]); } if (listBox1.Items.Count>0) button3.Enabled=true; } checklistbox方法: CheckedListBox.GetItemChecked 方法返回指示指定项是否选中的值。 参数 index :项的索引。 返回值:如果选中该项,则为 true;否则为 false。 异常类型 条件 ArgumentException 指定的 index 小于零。 - 或 - 指定的 index 大于或等于列表中项的计数。 CheckedListBox.GetItemCheckState 方法返回指示当前项的复选状态的值。 参数 index :要获取其选中值的项的索引。 返回值:CheckState 值之一(checked或unchecked)。 private void WhatIsChecked_Click(object sender, System.EventArgs e) { // Display in a...

1、当您付费下载文档后,您只拥有了使用权限,并不意味着购买了版权,文档只能用于自身使用,不得用于其他商业用途(如 [转卖]进行直接盈利或[编辑后售卖]进行间接盈利)。
2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。
3、如文档内容存在违规,或者侵犯商业秘密、侵犯著作权等,请点击“违规举报”。

碎片内容

确认删除?
VIP
微信客服
  • 扫码咨询
会员Q群
  • 会员专属群点击这里加入QQ群
客服邮箱
回到顶部