1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
string StringGreenColor = "pass";
string StringRedColor = "fail";
private void dataGridView1_CellPainting(object sender, DataGridViewCellPaintingEventArgs e)
{
if (e.ColumnIndex==1)
{
if (e.Value.ToString() == StringGreenColor)
{
e.CellStyle.BackColor = Color.LightGreen;
}
if (e.Value.ToString() == StringRedColor)
{
e.CellStyle.BackColor = Color.OrangeRed;
}
}
}
|