如何在visual studio 2010中更改一行数据网格视图的颜色c# [英] How to change the color of a row of data grid view in visual studio 2010 c#

查看:113
本文介绍了如何在visual studio 2010中更改一行数据网格视图的颜色c#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在visual studio 2010 c#中更改一行数据网格视图的颜色。

i想要查看除白色以外的特定数据行...我是怎么做的那样

解决方案

循环遍历数据网格的行,并根据你的条件改变颜色。

例如

  for  int  i =  0 ; i< dgvReservations.RowCount; i ++)
{
if (myGird.Rows [i] .Cells [ conditionCell] == myCondition);
{
myGrid.Rows [i] .DefaultCellStyle.BackColor = System.Drawing.Color.Red;
}
}


根据列值更改单个DataGridView行颜色 [ ^ ]


根据列值更改单个DataGridView行颜色 [ ^ ]

http://stackoverflow.com/questions/2189376/c-sharp-how-to -change-row-color-in-datagridview [ ^ ]

http://stackoverflow.com/questions/2189376/c-sharp-how-to-change-row-color-in-datagridview [<一个href =http://stackoverflow.com/questions/2189376/c-sharp-how-to-change-row-color-in-datagridviewtarget =_ blanktitle =New Window> ^ ]

How to change the color of a row of data grid view in visual studio 2010 c#.
i want to see a specific row of datagrid other than white color... how cna i do that

解决方案

Loop through the rows of the datagrid, and basaed on your conditions change the color.
For e.g.

for(int i = 0; i<dgvReservations.RowCount; i++)
{
if (myGird.Rows[i].Cells[conditionCell] == myCondition);
{
myGrid.Rows[i].DefaultCellStyle.BackColor = System.Drawing.Color.Red;
}
}


Change individual DataGridView row colors based on column value[^]


Change individual DataGridView row colors based on column value[^]
http://stackoverflow.com/questions/2189376/c-sharp-how-to-change-row-color-in-datagridview[^]
http://stackoverflow.com/questions/2189376/c-sharp-how-to-change-row-color-in-datagridview[^]


这篇关于如何在visual studio 2010中更改一行数据网格视图的颜色c#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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