Dev中GridControl设置指定列表头的背景色

设置列标题背景色:如列名gridcolumn,主视图gridview

gridchoilutmn.AppearanceHeader.BackColor=Color.Blue;

gridview.PaintStyleName="System" ;//此句必须用。值可以是自带皮肤。一般不用“Web”,因为它会 把其它按钮全部改为难看的样式。

 

另加一个属性Editable:是否允许用户编辑单元格。如果选中整行,此属性设置False,ReadOnly=True;

 

动态设置字体前景色:

private void gridview_RowStyle(object Sender,DevExpress.XtraGrid.VIews.Grid.ReStyleEnventArgse)

{

GridView view=sender as GridView;

  if (e.RowHandle > -1&&e.Column.Name== "列名称")
            {
                decimal 单元格值 = Convert.ToDecimal(view.GetRowCellValue(e.RowHandle, view.Columns["列名称"]));
                if (单元格值> 0)
                    e.Appearance.ForeColor = Color.Red;
          
            }

 

}

 

你可能感兴趣的:(C#+asp.net)