C#根据某一列的值改变显示方式

在init时添加

        ucGridView1.RowStyle += ucGridView1_RowStyle;
  #region 
        private void ucGridView1_RowStyle(object sender, DevExpress.XtraGrid.Views.Grid.RowStyleEventArgs e)
        {
            GridView View = sender as GridView;
            if (e.RowHandle >= 0)
            {
                object needAlert = View.GetRowCellValue(e.RowHandle, View.Columns["FREQUENCY"]);
                if (needAlert != null && needAlert.ToString().Trim().Contains("持续"))
                {
                         e.Appearance.ForeColor = Color.BlueViolet;
                         e.Appearance.BackColor = Color.LightGray;
                     
                }
            }
        }
        #endregion

你可能感兴趣的:(C#开发)