DevExpress控件-GridControl使用总结

单元格样式改变
        private void Gvw_dataList_CustomDrawCell(object sender, DevExpress.XtraGrid.Views.Base.RowCellCustomDrawEventArgs e)
        {
            if (e.Column.FieldName == "列名")
            {
                if (e.CellValue != null)
                {
                    if (e.CellValue.ToString() == "值")
                    {
                        e.Appearance.ForeColor = Color.Red;
                    }
                }
            }
        }


行样式改变
      private void Gvw_dataList_RowStyle(object sender, DevExpress.XtraGrid.Views.Grid.RowStyleEventArgs e)
        {
            try
            {
                int hand = e.RowHandle;
                if (hand < 0) return;
                DataRow dr = this.gvw_dataList.GetDataRow(hand);
                if (dr == null) return;
                if (dr["列名"]=="")
                {
                    e.Appearance.ForeColor = Color.Red;// 改变行字体颜色                   
                }
            }
            catch (Exception) { }
        }

你可能感兴趣的:(DevExpress控件-GridControl使用总结)