DevExpress.XtraGrid change a column of a cell given color Gert

private void gridView1_CustomDrawCell(object sender, DevExpress.XtraGrid.Views.Base.RowCellCustomDrawEventArgs e)
{
int count = this.gridView1.RowCount;
string strTemp = gridView1.GetRowCellValue(2, "实测值1").ToString().Trim();
StyleFormatCondition cn=null;
if (strTemp != "无故障")
{
cn = new StyleFormatCondition(FormatConditionEnum.GreaterOrEqual, gridView1.Columns["实测值1"], null, strTemp != "无故障");
cn.Appearance.ForeColor = Color.Red;
gridView1.FormatConditions.Add(cn);
}
}

Guess you like

Origin www.cnblogs.com/jianmin401059934/p/11164057.html