using DevExpress.Utils; using DevExpress.XtraEditors; using DevExpress.XtraGrid.Columns; using DevExpress.XtraGrid.Views.Grid; using DevExpress.XtraGrid.Views.Grid.ViewInfo; using System; using System.Collections.Generic; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; namespace IStation.WinFrmUI { /// /// GridView的颜色拓展类 /// public static class GridViewColorControl { #region 默认 /// /// 主表视图颜色样式设置 /// /// public static void SetGridMianViewColor(this GridView grid) { //聚焦 grid.Appearance.FocusedRow.Options.UseBackColor = true; grid.Appearance.FocusedRow.BackColor = SettingHelper.FocusRowColor; grid.Appearance.FocusedCell.Options.UseBackColor = true; grid.Appearance.FocusedCell.BackColor = SettingHelper.FocusRowColor; //奇偶行颜色 grid.OptionsView.EnableAppearanceOddRow = true; grid.Appearance.OddRow.Options.UseBackColor = true; grid.Appearance.OddRow.BackColor = SettingHelper.OddRowColor; // 设置奇数行颜色 grid.OptionsView.EnableAppearanceEvenRow = true; grid.Appearance.EvenRow.Options.UseBackColor = true; grid.Appearance.EvenRow.BackColor = SettingHelper.EvenRowColor; // 设置偶数行颜色 } /// /// 从表视图颜色样式设置 /// /// public static void SetGridSubViewColor(this GridView grid) { //聚焦 grid.Appearance.FocusedRow.Options.UseBackColor = true; grid.Appearance.FocusedRow.BackColor = SettingHelper.FocusRowColor; grid.Appearance.FocusedCell.Options.UseBackColor = true; grid.Appearance.FocusedCell.BackColor = SettingHelper.FocusRowColor; } #endregion } }