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);

 

 

            }

        }

posted @ 2018-08-20 10:43  执念、旧时光  阅读(694)  评论(0编辑  收藏  举报