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

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

问题描述

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

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

推荐答案

我让它工作了...在 RowPostPaint 事件中.. 如果我放入

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天全站免登陆