DevExpress改变GridView的颜色

using DevExpress.XtraGrid.Views.Grid;
    //注册RowStyleChange事件
    private void gridView1_RowStyle(object sender, DevExpress.XtraGrid.Views.Grid.RowStyleEventArgs e)
    {
        GridView view = sender as GridView;
        if (e.RowHandle >= 0)
        {
            string category = view.GetRowCellDisplayText(e.RowHandle, view.Columns["Category"]);
            if (category == "Beverages")
            {
                e.Appearance.BackColor = Color.Salmon;
                e.Appearance.BackColor2 = Color.SeaShell;
            }
        }
posted @ 2011-04-28 14:39  我在深圳搬砖  阅读(913)  评论(0编辑  收藏  举报