/// <summary> /// 节点背景色 /// Created:20170607(ChengMengjia) /// 未开始的没有背景色(值为0),已完成的为蓝色(1),正在执行的为黄色(2),超期的为红色(3) /// </summary> /// <param name="status"></param> /// <returns></returns> public static CellVisualStyles MatchRowColor(int?status) { CellVisualStyles style = new CellVisualStyles(); switch (status) { case 1: style.Default.Background.Color1 = Color.CornflowerBlue; break; case 2: style.Default.Background.Color1 = Color.Orange; break; case 3: style.Default.Background.Color1 = Color.Red; style.Default.TextColor = Color.White; break; default: style.Default.Background.Color1 = Color.Transparent; break; } return(style); }
private void mouseWheel(object sender, MouseEventArgs e) { if (CtrlPressed) { GridPanel panel = LendGrid.PrimaryGrid; CellVisualStyles cs = panel.DefaultVisualStyles.CellStyles; if (e.Delta > 0) { Font f = new Font(cs.Default.Font.FontFamily, cs.Default.Font.Size + 1); cs.Default.Font = f; panel.DefaultRowHeight++; panel.DefaultVisualStyles.ColumnHeaderStyles.Default.Font = f; } else { if (cs.Default.Font.Size <= 8) { return; } Font f = new Font(cs.Default.Font.FontFamily, cs.Default.Font.Size - 1); cs.Default.Font = f; panel.DefaultRowHeight--; panel.DefaultVisualStyles.ColumnHeaderStyles.Default.Font = f; } } }
/// <summary> /// 设置项目经理背景颜色 /// 2017/06/12(zhuguanjun) /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void superGridControl1_DataBindingComplete(object sender, GridDataBindingCompleteEventArgs e) { List <GridElement> listRow = superGridControl1.PrimaryGrid.Rows.ToList(); int type = 0; foreach (GridElement obj in listRow) { GridRow row = (GridRow)obj; type = int.Parse(row.GetCell("IsPublic").Value.ToString()); if (type != 0) { CellVisualStyles style = new CellVisualStyles(); style.Default.Background.Color1 = Color.CornflowerBlue; row.CellStyles = style; } } }
private void mouseWheel(object sender, MouseEventArgs e) { GridPanel panel = ArchiveGrid.PrimaryGrid; CellVisualStyles cs = panel.DefaultVisualStyles.CellStyles; if (!CtrlPressed || (cs.Default.Font.Size <= 8 && e.Delta < 0)) { return; } int step = e.Delta > 0 ? 1 : -1; Font f = new Font(cs.Default.Font.FontFamily, cs.Default.Font.Size + step); cs.Default.Font = f; panel.DefaultRowHeight += step; panel.DefaultVisualStyles.ColumnHeaderStyles.Default.Font = f; foreach (GridColumn gc in panel.Columns) { gc.Width += step * 4; } }
/// <summary> /// 设置背景色 /// 2017/06/09(zhuguanjun) /// </summary> /// <param name="status"></param> /// <returns></returns> public static CellVisualStyles MatchRowColor(int?status) { CellVisualStyles style = new CellVisualStyles(); switch (status) { case -1: style.Default.Background.Color1 = Color.LightGray; break; case 0: style.Default.Background.Color1 = Color.LightGray; break; default: style.Default.Background.Color1 = Color.White; break; } return(style); }
internal void ApplyCellStyle(CellVisualStyle style, StyleType cs) { ValidateStyle(); if (_EffectiveCellStyles == null) _EffectiveCellStyles = new CellVisualStyles(); if (_EffectiveCellStyles.IsValid(cs) == false) { GridPanel panel = GridPanel; int colIndex = panel.UseAlternateColumnStyle ? panel.Columns.GetDisplayIndex(this) : -1; CellVisualStyle cstyle = new CellVisualStyle(); if ((colIndex % 2) > 0) { cstyle.ApplyStyle(SuperGrid.BaseVisualStyles.AlternateColumnCellStyles[cs]); cstyle.ApplyStyle(SuperGrid.DefaultVisualStyles.AlternateColumnCellStyles[cs]); cstyle.ApplyStyle(GridPanel.DefaultVisualStyles.AlternateColumnCellStyles[cs]); } cstyle.ApplyStyle(CellStyles[cs]); _EffectiveCellStyles[cs] = cstyle; } style.ApplyStyle(_EffectiveCellStyles[cs]); }
private void ValidateStyle() { if (_StyleUpdateCount != SuperGrid.StyleUpdateCount) { _EffectiveCellStyles = null; _StyleUpdateCount = SuperGrid.StyleUpdateCount; } }
internal void ApplyCellStyle(CellVisualStyle style, StyleType cs) { ValidateStyle(); if (_EffectiveCellStyles == null) _EffectiveCellStyles = new CellVisualStyles(); if (_EffectiveCellStyles.IsValid(cs) == false) { GridPanel panel = GridPanel; int rowIndex = panel.UseAlternateRowStyle ? GridIndex : -1; if (rowIndex >= 0 && Parent is GridGroup) rowIndex -= ((GridGroup)Parent).GridIndex + 1; CellVisualStyle cstyle = new CellVisualStyle(); if ((rowIndex % 2) > 0) { cstyle.ApplyStyle(SuperGrid.BaseVisualStyles.AlternateRowCellStyles[cs]); cstyle.ApplyStyle(SuperGrid.DefaultVisualStyles.AlternateRowCellStyles[cs]); cstyle.ApplyStyle(GridPanel.DefaultVisualStyles.AlternateRowCellStyles[cs]); } cstyle.ApplyStyle(CellStyles[cs]); _EffectiveCellStyles[cs] = cstyle; } style.ApplyStyle(_EffectiveCellStyles[cs]); }