在RowStyle事件里,从数据上进行判断。
private void gridView1_RowStyle(object sender, DevExpress.XtraGrid.Views.Grid.RowStyleEventArgs e)
{
int hand = e.RowHandle;
if (hand < 0) return;
Production salesDocCount = this.gridView1.GetRow(hand) as Production;
if (salesDocCount == null) return;
if (salesDocCount.statusName == "待处理")
{
e.Appearance.BackColor = Color.FromArgb(225, 238, 26);
}
else if (salesDocCount.statusName == "未匹配")
{
e.Appearance.BackColor = Color.FromArgb(210, 219, 40);
}
}