DevExpress的gridcontrol里面,如何设置指定行的某列的背景色?
假设该gridcontrol里面的gridview1,它已经获取了一张表的数据,如下:
字段1 字段2 字段3
陈 18 男
李 22 男
现在要求在程序里对字段1为“李”的那行的字段3的那一列的背景色设置为红色,这个代码该怎么写?
我现在知道可以设置字段1的这一列的背景色为红色,如下:
private void gridView_1CustomDrawCell(object sender, DevExpress.XtraGrid.Views.Base.RowCellCustomDrawEventArgs e) { if (e.DisplayText.IndexOf("李") > -1) { e.Appearance.BackColor = Color.Red; } }