C#的DataGridView中某一单元格显示颜色怎么弄啊? C#的DataGridView中某一单元格显示颜色怎么弄啊? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 private void dataGridView1_RowPrePaint(object sender, DataGridViewRowPrePaintEventArgs e) { if (e.RowIndex > = dataGridView1.Rows.Count - 1) return; DataGridViewRow dgr = dataGridView1.Rows[e.RowIndex]; try { if (dgr.Cells[ "列名 "].Value.ToString() == "比较值 ") { dgr.DefaultCellStyle.ForeColor = 设置的颜色; } } catch (Exception ex) { MessageBox.Show(ex.Message); } } http://www.cnblogs.com/Echang/articles/1030596.html dataGridView.Rows[行号].Cells["列明"].Style.BackColor = Color.Red; dataGridView[列号,行号].Style.BackColor = Color.Red; dataGridView.Rows[行号].Cells["列明"].Style.BackColor = Color.Red; 一个数组的算法问题. C#中查询问题 求一个正则表达式替换 xna4.0 C#中打开对话窗口,如何做到关闭这个窗口后再执行后面代码? 请教如何在datagrid中显示多个表的数据 如何取得异常的号码呢. c#2005中的报表问题 为什么会查找不到相应tabPage?在线等! 急!多个项目如何相互调用?如何取消其它项目的虚拟目录?把它们融合在一个解决方案里? 新手求解:C#编写程序判断选择题总的和分的正确率 sqlbulkcopy问题
private void dataGridView1_RowPrePaint(object sender, DataGridViewRowPrePaintEventArgs e)
{
if (e.RowIndex > = dataGridView1.Rows.Count - 1)
return;
DataGridViewRow dgr = dataGridView1.Rows[e.RowIndex];
try
{
if (dgr.Cells[ "列名 "].Value.ToString() == "比较值 ")
{
dgr.DefaultCellStyle.ForeColor = 设置的颜色;
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
} http://www.cnblogs.com/Echang/articles/1030596.html