此文章发布于66
个月前,部分信息可能已经过时
,请自行斟酌确认。
StyleFormatCondition formatCondition = new StyleFormatCondition();
formatCondition.Appearance.Options.UseForeColor = true;
formatCondition.Appearance.Options.HighPriority = true;
formatCondition.ApplyToRow = true;
formatCondition.Condition = FormatConditionEnum.Expression;
formatCondition.Expression = "Quantity>30"; //根据公式表达式设置颜色
formatCondition.Appearance.ForeColor = Color.FromArgb(170, 0, 0); //颜色
this.gridView1.FormatConditions.Add(formatCondition);