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 1911: [Apio2010]特别行动队
    bzoj 1096: [ZJOI2007]仓库建设
    bzoj 3522: [Poi2014]Hotel
    bzoj 3572: [Hnoi2014]世界树
    bzoj 1177: [Apio2009]Oil
    bzoj 1912: [Apio2010]patrol 巡逻
    bzoj 3573: [Hnoi2014]米特运输
    bzoj 3997: [TJOI2015]组合数学
    cf 506 A. Mr. Kitayuta, the Treasure Hunter
    cf 500 D. New Year Santa Network
  • 原文地址:https://www.cnblogs.com/djian/p/1901799.html
Copyright © 2011-2022 走看看