// 添加行后, 获取"取消"字符所在的列, 设置该单元格中的字体颜色
            foreach (DataGridViewRow dgv in this.dataGridView1.Rows)
            {
                if (dgv.Cells["取消字符所在的列名"].Value.ToString().Equals("取消"))
                {
                    dgv.DefaultCellStyle.ForeColor = Color.Yellow;
                }
            }
这是我在绑定数据后使用, 再设置字体颜色的代码, 供你参考.

解决方案 »

  1.   

    for(int i=0;i<DatagridView1.rows.cou;i++)
    {
    if (dgv.Cells["取消字符所在的列名"].Value.ToString().Equals("取消"))
                    {
                        dgv.DefaultCellStyle.ForeColor = Color.你要的颜色;
                    }
    }
      

  2.   

    用:dgv_CellFormatting方法 遍历dgvprivate void dgv_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
            {
                if (dgv.Columns[e.ColumnIndex].Name == "取消列名")
                {
                    //判断 e.Value==“取消” 改颜色
                }
            }
    自己琢磨一下吧,我认为这个可以。
      

  3.   

    用:dgv_CellFormatting方法 遍历dgvprivate void dgv_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
            {
                if (dgv.Columns[e.ColumnIndex].Name == "取消列名")
                {
                    //判断 e.Value==“取消” 改颜色
                }
            }
    自己琢磨一下吧,我认为这个可以。
      

  4.   

    取那个单元格,如当前单元格dgv.CurrentCell,设置其Style:
    dgv.CurrentCell.Style.ForeColor=Color.Red;
      

  5.   

    这个可供参考:
                for (int i = 0; i < this.dataGridView1.Rows.Count; i++)
                {
                    for (int j = 0; j < this.dataGridView1.Columns.Count; j++)
                    {
                        this.dataGridView1.CurrentCell = this.dataGridView1.Rows[i].Cells[j];
                        if (Convert.ToInt32(this.dataGridView1.CurrentCell.Value) == 112)
                        {
                           this.dataGridView1.CurrentCell.Style.ForeColor = Color.Red ;
                        }                }
                }