datagridview中的单元格格式化事件 [英] Cellformatting event in datagridview

查看:395
本文介绍了datagridview中的单元格格式化事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在通过使用vb.net代码根据条件提供单元格颜色来格式化datagridview.我已经在datagridview的cellformatting事件中编写了代码.
它工作正常,但是事件一次又一次被调用,这减慢了我的datagridview.
无论如何,有一次我可以停止一次绘制它的单元格事件调用吗?

解决方案

使用Datagridview的 CurrentCellDirtyStatechange 方法
并检查列的索引,这意味着您要为该列的单元格应用此变色条件,以便在更改其他列的单元格时它不会执行该代码...

祝您编码愉快!
:)


i am formatting datagridview by providing cell color as per condition using vb.net code . I have written code in cellformatting event of datagridview.
It is working fine, but the event gets called again and again, which slows down my datagridview.
Is there anyway where i can stop the cellformatting event call again and again once it gets painted?

解决方案

use Datagridview''s CurrentCellDirtyStatechange method
and also check the index of column, means for which column''s cell you want to apply this color-changing condition so, that it will not execute that code when other column''s cells are being change...

Happy Coding!
:)


这篇关于datagridview中的单元格格式化事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆