private void gridView1_CustomDrawCell(object sender, DevExpress.XtraGrid.Views.Base.RowCellCustomDrawEventArgs e)
{
if (!gridView1.IsValidRowHandle(e.RowHandle)) return;
TimeSpan midTime = DateTime.Now - DateTime.Parse(gridView1.GetDataRow(e.RowHandle)["TK_TIME"].ToString());
if (midTime.TotalHours > 24)
{
e.Appearance.BackColor = Color.Yellow;
e.Appearance.BackColor2 = Color.Yellow;
}
if (
string.Equals(gridView1.GetDataRow(e.RowHandle)["ERR_CODE"].ToString(), "1")
|| string.Equals(gridView1.GetDataRow(e.RowHandle)["ERR_CODE"].ToString(), "99999")
{
e.Appearance.BackColor = Color.Red;
e.Appearance.BackColor2 = Color.Red;
}
}
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/aa9162518790410379139e4ff44e9623.png)