触发DataGridView中的复选框值更改事件

编程入门 行业动态 更新时间:2024-10-26 21:24:30
本文介绍了触发DataGridView中的复选框值更改事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 我有一个具有复选框列的网格视图,并且我想要在单元格的值切换时立即触发绘图事件。我尝试了ValueChaged和CellEndEdit和BeginEdit,并选择了选择模式为CellSelect。对于前两个事件,事件在编辑模式完成后被触发,例如移出当前单元格,或者来回移动。这只是一个奇怪的行为。

一旦单元格值更改,有什么可以触发网格视图上的事件吗?

最好的问候,

解决方案

我的同事建议您捕获CurrentCellDirtyStateChanged事件。请参阅 msdn.microsoft/ en-us / library / system.windows.forms.datagridview.currentcelldirtystatechanged.aspx 。

I have a grid view that has a check box column, and I want to trigger a drawing event as soon as the value of the cell is toggled. I tried the ValueChaged and the CellEndEdit and BeginEdit, and chose the selection mode as CellSelect. As for the the first 2 events, the event was triggered upon the finishing of the edit mode, like moving out of the current cell, or going back and forth. It's just a weird behavior.

Is there anything that triggers the event on the grid view as soon as the cell value is changed?

Best Regards,

解决方案

A colleague of mine recommends trapping the CurrentCellDirtyStateChanged event. See msdn.microsoft/en-us/library/system.windows.forms.datagridview.currentcelldirtystatechanged.aspx.

更多推荐

触发DataGridView中的复选框值更改事件

本文发布于:2023-11-04 01:24:01,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1556564.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:复选框   事件   DataGridView

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!