DataGridView中的单元格颜色未更改 [英] Cell Color not Change In DataGridView

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

问题描述

foreach (DataGridViewRow row in gvPlanning.Rows)
           {
               for (i = 1; i <= 10; i++)
               {
                   string color = row.Cells["Color"].Value.ToString();
                   if (color != "")
                   {                      
                     
                       row.Cells["Col1"].Style.BackColor =System.Drawing.Color.Red;
                       row.Cells["Col2"].Style.BackColor = System.Drawing.Color.Red; 

                   }
               }





我使用上面的代码为特定单元格设置了背面颜色但是它不工作



I m using above code for set back color for particluar cells but its not working

推荐答案

看看这个



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


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

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