在GridView DevExpress中为特定单元格着色 [英] Color a specific cell in a GridView DevExpress

查看:91
本文介绍了在GridView DevExpress中为特定单元格着色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用外观设置为单元格着色时出现此错误



'DevExpress.XtraGrid.StyleFormatCondition'不包含'外观'的定义



这个我正在尝试使用的代码,请帮助



I am getting this error while using appearance setting to color a cell

'DevExpress.XtraGrid.StyleFormatCondition' does not contain a definition for 'Appearance'

this the code that i'm trying to use, please help

private void gridView3_RowCellStyle(object sender, DevExpress.XtraGrid.Views.Grid.RowCellStyleEventArgs e)
{
    GridView View = sender as GridView;
    if (e.Column.FieldName == "First Name" &&
        string.IsNullOrEmpty(View.GetRowCellDisplayText(e.RowHandle, e.Column)))
    {
        e.Appearance.BackColor = Color.DeepSkyBlue;
    }
}

推荐答案

HI,



使用如下:





Use like the following:

e.Row.Cells[0].BackColor = Color.Red;





代替





in place of

e.Appearance.BackColor = Color.DeepSkyBlue;





谢谢



Thanks


如果有帮助,请看这个帖子。



改变细胞颜色



摘要



你需要什么处理 GridView.CustomDrawCell 事件。



Please see this thread if it helps.

Change Cell color

Summary

you need to handle GridView.CustomDrawCell event.

Private Sub grdView_CustomDrawCell(sender As Object, e As RowCellCustomDrawEventArgs)





谢谢



Thanks


这篇关于在GridView DevExpress中为特定单元格着色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆