按条件设置gridcontrol 单元格属性

等价代码设置:(注意这里使用都是FieldName, 即绑定对象的字段名)

var cn = new StyleFormatCondition(FormatConditionEnum.Expression);
cn.Expression = "[ProduceName] !=null";
cn.Column = gridView4.Columns["Process"];
cn.ApplyToRow = true;

cn.Appearance.BackColor = Color.Green;
//cn.Appearance.Font = new Font(AppearanceObject.DefaultFont, FontStyle.Strikeout);
//cn.Appearance.ForeColor = SystemColors.ActiveCaptionText;
gridView4.FormatConditions.Add(cn);

原文地址:https://www.cnblogs.com/wdfrog/p/4254092.html