日期:2014-05-18  浏览次数:20744 次

C#2005的DataGridView问题
如何让DataGridView的某一些特殊的数据设置成红色呢?
例如:
单据编号 金额 出仓仓库名称 ........等
B000001 10000.00 某某仓库
B000002 20000.00 某某仓库B000003 30000.00 某某仓库


比如:单据编号B000002已经打印过了...数据库中有记录的...
那现在我想把编号B000002的这一行数据(字体设置为红色)怎么搞呢? 不是背景设置为红色而是字体
请高手们帮帮忙 谢谢...

------解决方案--------------------
for(int i=0;i<this.DataGridView1.Rows.count;i++)
{
if(满足条件)
{
this.DataGridView1.Rows[i].ForeColor = Color.Red; 
}
}
------解决方案--------------------
this.dataGridView1.Rows[3].DefaultCellStyle.ForeColor = Color.Red;
------解决方案--------------------
for(int i=0;i <this.DataGridView1.Rows.count;i++) 

if(满足条件) 
{ //修改前景和背景色
this.dataGridView.Rows[i].DefaultCellStyle.BackColor = Color.Red;
或者this.dataGridView.Rows[i].DefaultCellStyle.ForeColor = Color.Yellow;


}