protected Brush GetNonRegularBrush(DataGridCellType ctype) { switch (ctype) { case DataGridCellType.AddedRow: return(AddedCellBrush); case DataGridCellType.ModifiedCell: return(ModifiedCellBrush); case DataGridCellType.ModifiedRow: return(ModifiedRowBrush); case DataGridCellType.RemovedRow: return(RemovedCellBrush); case DataGridCellType.Highlight: return(HighlightBrush); } return(null); }
public override void PaintCellBackground(DataGridViewCellPaintingEventArgs e, DataGridCellType ctype) { Brush bg = SystemBrushes.Window; bg = GetNonRegularBrush(ctype) ?? bg; if (ctype == DataGridCellType.Selected) { bg = SystemBrushes.Highlight; } e.Graphics.FillRectangle(bg, e.CellBounds); }
public abstract void PaintCellBackground(DataGridViewCellPaintingEventArgs e, DataGridCellType ctype);
public override void PaintCellBackground(DataGridViewCellPaintingEventArgs e, DataGridCellType ctype) { Brush bg = Brushes.White; Brush fg = Brushes.Black; if (e.RowIndex > 0 && e.RowIndex % 2 == 1) { bg = EvenRowBrush; } bg = GetNonRegularBrush(ctype) ?? bg; if (ctype == DataGridCellType.Selected) { bg = Brushes.Navy; } e.Graphics.FillRectangle(bg, e.CellBounds); }