当前位置:网站首页>The use of C# control CheckBox
The use of C# control CheckBox
2022-07-31 13:15:00 【dusk and starry sky】
Use the CheckBox control
Today, I used the CheckBox control, record it here.
Tools: Visual Studio 2017 (other versions also work)
Method/step:
1. Drag the CheckBox control to the window, as shown in the following figure:
2. Change the name of the control to CBox
3. Common methods of this control:
this.CheckBox.Checked = true; //Set the control state to checked
this.CheckBox.Checked= false; //Set the control state to unchecked
//or
this.CheckBox.CheckState = CheckState.Checked; //Set the control state to checked
this.CheckBox.CheckState =CheckState.Unchecked; //Set the control state to unchecked
4. How to judge the current state of the control
this.CBox.Checked
if(this.CBox.Checked==ture)
{
MessageBox.Show("Choose");
}
else
{
MessageBox.Show(“No Choose”);
}
5. Double-click the control, an event will be added (when the state of the control changes)
At this time, a function related to the attribute will be generated, and the related function can be realized by editing the function, as shown below:
private void CBox_CheckedChanged(object sender, EventArgs e){if (this.CBox.Checked == true){MessageBox.Show("Choose");}else{MessageBox.Show("No Choose");}}边栏推荐
猜你喜欢

PyQt5快速开发与实战 10.1 获取城市天气预报

报错:npm ERR code EPERM

深入浅出边缘云 | 4. 生命周期管理

CentOS7 - yum install mysql

深圳某游戏研发公司每个工位都装监控,网友:堪比“坐牢”!

C#控件CheckBox的使用

ERROR 1819 (HY000) Your password does not satisfy the current policy requirements

C# 中的Async 和 Await 的用法详解
![LRU缓存[线性表 -> 链表 -> hash定位 -> 双向链表]](/img/ad/dd80541514d6fedde8c730218fdf5a.png)
LRU缓存[线性表 -> 链表 -> hash定位 -> 双向链表]

Introduction to using NPM
随机推荐
[RPI]树莓派监控温度及报警关机保护「建议收藏」
How IDEA runs web programs
golang八股文整理(持续搬运)
集群的安全模式
IDEA连接MySQL数据库并执行SQL查询操作
NameNode故障处理的两种方法
P5019 [NOIP2018 提高组] 铺设道路
365-day challenge LeetCode1000 questions - Day 044 Maximum element in the layer and level traversal
centos7安装mysql5.7
行业案例 | 全面防护 赛宁助力能源工控安全建设
centos7安装mysql5.7步骤(图解版)
CentOS7 安装MySQL 图文详细教程
vivado里那些看不懂的原语
Error IDEA Terminated with exit code 1
图像大面积缺失,也能逼真修复,新模型CM-GAN兼顾全局结构和纹理细节
Golang - gin - pprof - use and safety
Batch大小不一定是2的n次幂!ML资深学者最新结论
sqlalchemy 判断一个array 类型的字段是否和一个array有至少一个一致的数据
网络层重点协议——IP协议
CWE4.8 -- 2022年危害最大的25种软件安全问题