DevExpress控件给数据列表中特殊行数据设置颜色
private void SetGridRowStyle()
{
//颜色设置
if ( !string.IsNullOrEmpty(txtCphm.Text) ) {
MainView.FormatConditions.Clear();
DevExpress.XtraGrid.StyleFormatCondition styleFormatBlue = new DevExpress.XtraGrid.
StyleFormatCondition(DevExpress.XtraGrid.FormatConditionEnum.Equal, clCphm, "", txtCphm.Text.ToUpper(), "");
styleFormatBlue.Appearance.ForeColor = System.Drawing.Color.Red;
styleFormatBlue.Appearance.Font = new System.Drawing.Font("Tahoma", 8F, System.Drawing.FontStyle.Bold);
styleFormatBlue.Appearance.BackColor = Color.Yellow;
styleFormatBlue.ApplyToRow = true;
MainView.FormatConditions.Add(styleFormatBlue);
}
}