private void dataGridView1_CellPainting(object sender, DataGridViewCellPaintingEventArgs e)
{
if (e.RowIndex > -1)
{
int intGrade = Convert.ToInt32(this.dataGridView1.Rows[e.RowIndex].Cells["dgvAge"].Value);
if (intGrade ==30)
{
dataGridView1.Rows[e.RowIndex].DefaultCellStyle.BackColor = Color.Red;
}
else if(intGrade==25)
{
dataGridView1.Rows[e.RowIndex].DefaultCellStyle.BackColor = Color.Brown;
}
}
}

posted on 2019-02-28 01:02  文龙再现  阅读(224)  评论(0编辑  收藏  举报