Exemple #1
0
        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);
        }
Exemple #2
0
        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);
        }
Exemple #3
0
 public abstract void PaintCellBackground(DataGridViewCellPaintingEventArgs e, DataGridCellType ctype);
Exemple #4
0
        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);
        }