I have found the solution of this problem. We should use RowStyle event of XtraDatagrid.
private void gridView1_RowStyle(object sender, DevExpress.XtraGrid.Views.Grid.RowStyleEventArgs e)
{
if (e.RowHandle >= 0)
{
DataRow DR = gridView1.GetDataRow(e.RowHandle);
if (DR["SEX"].ToString() == "Male")
e.Appearance.BackColor = System.Drawing.Color.LightGoldenrodYellow;
if (DR["Age"].ToString() < "20")
e.Appearance.BackColor = System.Drawing.Color.Bisque;
if (DR["OCCUPATION"].ToString() == "Engineer")
e.Appearance.BackColor = System.Drawing.Color.LightBlue;
// etc...
}
}
0 comments:
Post a Comment