zoukankan      html  css  js  c++  java
  • GridView改变单行背景色

                DevExpress.XtraGrid.StyleFormatCondition StyleFormatCondition1 = new DevExpress.XtraGrid.StyleFormatCondition();
                StyleFormatCondition1.Appearance.BackColor = System.Drawing.Color.Red;
                StyleFormatCondition1.Appearance.BackColor2 = Color.White;
                StyleFormatCondition1.Appearance.Options.UseBackColor = true;
                //StyleFormatCondition1.ApplyToRow = true;
                StyleFormatCondition1.Column = MainView.Columns[0];
                StyleFormatCondition1.Condition = DevExpress.XtraGrid.FormatConditionEnum.Equal;
                StyleFormatCondition1.Value1 = "wyl2";
                MainView.FormatConditions.AddRange(new DevExpress.XtraGrid.StyleFormatCondition[] { StyleFormatCondition1 });

    也可以:

    在GridControl中的Gridview的CustomDrawCell写如下代码private void gridView1_CustomDrawCell(object sender, DevExpress.XtraGrid.Views.Base.RowCellCustomDrawEventArgs e)
            {
                    if (e.RowHandle==1)
                    {

                        //字体颜色,也可改变背景颜色等属性
                        e.Appearance.ForeColor = Color.Red;
                    }
                   if (e.RowHandle==3)
                    {

                        //字体颜色,也可改变背景颜色等属性
                        e.Appearance.ForeColor = Color.Red;
                    }

            } (其他DX控件都有此类似方法来改变属性)

    本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/david04310711323/archive/2008/07/21/2684144.aspx

  • 相关阅读:
    【BZOJ】4636: 蒟蒻的数列
    BZOJ1878 [SDOI2009]HH的项链
    【网络流24题----02】太空飞行计划
    【网络流24题----03】Air Raid最小路径覆盖
    【网络流24题----01】飞行员配对方案问题
    素数判定(米勒测试定理-费马小定理+快速乘)
    一堆模板(丑陋0.0)------数据结构
    丑数(USACO)
    NOI[2001]食物链
    关于Tarjan(2)
  • 原文地址:https://www.cnblogs.com/djian/p/1901799.html
Copyright © 2011-2022 走看看