当前位置:网站首页>Basic use of check boxes and implementation of select all and invert selection functions
Basic use of check boxes and implementation of select all and invert selection functions
2022-06-23 08:15:00 【Scarlett2025】
Checked attribute , Mark the current checkbox status ( When selected, it is True otherwise False)
ThreeState There are three selected states
according to CheckState To judge (Checked[ Choose ] , Unchecked[ No choice ] , Indeterminate[ Tree structure , A state of being , Indicates that there are one or more children under the current tree structure ( Not all children ) To be selected ])
CheckedChanged event : Indicates whether the current control is selected
The layout of the page is as follows :

double-click 【 select all 】 Button , The code is as follows :
private void AllSelected_Click(object sender, EventArgs e)
{
for (int i = 0; i < this.Controls.Count; i++)
{
CheckBox cb = this.Controls[i] as CheckBox; // equivalent
// resolvent 1 , Judge cb Is it null.
if (cb != null)
{
cb.Checked = true;
}
}
}double-click 【 Deselect all 】 Button , The code is as follows :
private void CancelAll_Click(object sender, EventArgs e)
{
for (int i = 0; i < this.Controls.Count; i++)
{
CheckBox cb = this.Controls[i] as CheckBox;
// resolvent 2, Determine the current control's type
if (this.Controls[i].GetType() == typeof(CheckBox))
{
cb.Checked = false;
}
}
}边栏推荐
- C Advanced Learning -- extended method (this)
- Fillet the tabbar with the flutter
- Multi Chain and cross chain are the future
- C RichTextBox controls the maximum number of rows
- jmeter压测结果分析
- The essence of five good books on wealth and freedom
- Captain Abu's soul torture
- C print zoom
- APM performance monitoring practice of jubasha app
- Vulnhub | DC: 4 |【實戰】
猜你喜欢

Imperva- method of finding regular match timeout

Socket socket programming

On ThreadLocal and inheritablethreadlocal, source code analysis

Openvino series 19 Openvino and paddleocr for real-time video OCR processing

开源软件、自由软件、Copyleft、CC都是啥,傻傻分不清楚?

记一次高校学生账户的“从无到有”

81 sentences worth repeating

Use of tensorboard

INT 104_LEC 06

图像分割-改进网络结构
随机推荐
GTEST死亡测试
Does huangrong really exist?
Jetpack family - ViewModel
Azure Active Directory brute force attack
Vulnhub | DC: 4 |【實戰】
Vulnhub | dc: 3 | [actual combat]
力扣(LeetCode)173. 二叉搜索树迭代器(2022.06.22)
transform的结构及用法
GTEST death test
开源软件、自由软件、Copyleft、CC都是啥,傻傻分不清楚?
C#重启应用程序
Use of tensorboard
Set the time zone in ci4 (CodeIgniter 4)
C Scrollview scroll up or scroll down
配置ASMX无法访问
7-调色板-CALayer和触摸
How can easycvr access the Dahua CVS video recorder and download a video file with an empty name?
建立一有序的顺序表,并实现下列操作: 1.把元素x插入表中并保持有序; 2.查找值为x的元素,若找到将其删除; 3.输出表中各元素的值。
看了5本书,我总结出财富自由的这些理论
Lightweight UI control library worth collecting