datagridviews单元格背景颜色和文本的条件更改 [英] conditional change of a datagridviews cell background color and text

查看:136
本文介绍了datagridviews单元格背景颜色和文本的条件更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是一个winform vb.net 2008应用程序。我从数据库中带回数据,并基于一些静态条件...我想改变背景和文本的颜色。在winform中没有rowdatabound事件...



希望有人可以提供一些指导
感谢
shannon


<在 RowPostPaint 事件中,我得到它工作...如果我放在

  if(my criteria here)
Me.dgTableInfo.Rows(e.RowIndex).Cells(ColumnName)。 BackColor = Color.Red
end if


This is for a winform vb.net 2008 app. I'm bringing data back from a database and based on some static conditions... i want to change the color of the background and the text. There is no rowdatabound event in winform...

hope someone can provide some guidance thanks shannon

解决方案

I got it working... in the RowPostPaint event.. If I put in

if (my criteria here)
    Me.dgTableInfo.Rows(e.RowIndex).Cells("ColumnName").Style.BackColor = Color.Red
end if

这篇关于datagridviews单元格背景颜色和文本的条件更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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