DataGridView中DataGridViewCheckBoxCell点击选中状态的理解
来源:互联网 发布:阿里云服务器登陆密码 编辑:程序博客网 时间:2024/05/16 05:23
DataGridViewCheckBoxCell的EditedFormattedValue、FormattedValue属性:
点击方框即可触发DataGridView的CurrentCellDirtyStateChanged事件, EditedFormattedValue=true,在触发其他事件之前,DataGridViewCheckBoxCell的编辑状态未结束,FormattedValue=false;
一旦触发其他事件(点击按钮或者点击下一个方框等(如果点击下一个方框,则触发两次CurrentCellDirtyStateChanged事件)),则会再次触发DataGridView的CurrentCellDirtyStateChanged事件,此时EditedFormattedValue=true,FormattedValue=true;
即触发两次 CurrentCellDirtyStateChanged事件(每完成EditedFormattedValue=true,FormattedValue=true需要触发两CurrentCellDirtyStateChanged事件);
private void dgvHuoWei_CurrentCellDirtyStateChanged(object sender, EventArgs e) { DataGridViewCheckBoxCell chkBoxCell = new DataGridViewCheckBoxCell(); for (int i = 0; i < dgvHuoWei.Rows.Count; i++) { chkBoxCell = (DataGridViewCheckBoxCell)dgvHuoWei.Rows[i].Cells[0]; if (chkBoxCell != null && ((bool)chkBoxCell.EditingCellFormattedValue == true && (bool)chkBoxCell.FormattedValue == true)) { } } }
(可以直接在方法中判断 EditedFormattedValue是否为true对选中行操作!最好不在CurrentCellDirtyStateChanged事件中判断,这样容易出错。)
0 0
- DataGridView中DataGridViewCheckBoxCell点击选中状态的理解
- DataGridView 中捕捉 CheckBox ( DataGridViewCheckBoxCell ) 列的状态改变
- 如何在winform的 DataGridView 中捕捉 CheckBox ( DataGridViewCheckBoxCell ) 列的状态改变
- 如何在winform的 DataGridView 中捕捉 CheckBox ( DataGridViewCheckBoxCell ) 列的状态改变
- 如何在winform的 DataGridView 中捕捉 CheckBox ( DataGridViewCheckBoxCell ) 列的状态改变
- 如何在winform的 DataGridView 中捕捉 CheckBox ( DataGridViewCheckBoxCell ) 列的状态改变
- 如何在winform的 DataGridView 中捕捉 CheckBox ( DataGridViewCheckBoxCell ) 列的状态改变 .
- 如何在winform的 DataGridView 中捕捉 CheckBox ( DataGridViewCheckBoxCell ) 列的状态改变
- winform的DataGridView中捕捉CheckBox ( DataGridViewCheckBoxCell ) 列的状态改变
- DataGridView - DataGridViewCheckBoxCell的使用
- DataGridView - DataGridViewCheckBoxCell的使用
- DataGridView中设置DataGridViewCheckBoxCell等的enable属性
- Datagridview DataGridViewCheckBoxCell
- C#中DataGridView控件鼠标点击选中行的问题
- C#中Datagridview的CheckBox获取选中状态的不同
- C# WinForm 实现DataGridView中DataGridViewCheckBoxCell的变通单一勾选
- dataGridView空白列,默认选中行的背景色,dataGridView中加入复选框勾选状态的更改
- C# DataGridView控件中点击选中行颜色更改
- linux内核数据结构之kfifo(实现)
- 23种设计模式中,自己比较熟悉的6种模式
- 免费的计算机编程类中文书籍大汇总
- mongodb数据库插入文档insert方法
- java super this
- DataGridView中DataGridViewCheckBoxCell点击选中状态的理解
- AndroidManifest versionCode
- nginx代理出现数据被截断的问题
- Xcode使用介绍之四:自动布局初体验
- python 某些数据类型使用
- ecshop安装到php5.2版本以上出错,解决方法
- 如何检测SQL注入和CSS攻击漏洞
- 算法系列-直接选择排序
- 动态规划之01背包