System.Windows.Forms.DataGridView.OnCellPainting(System.Windows.Forms.DataGridViewCellPaintingEventArgs)

Here are the examples of the csharp api class System.Windows.Forms.DataGridView.OnCellPainting(System.Windows.Forms.DataGridViewCellPaintingEventArgs) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

3 Examples 7

1. Example

View license
protected override void OnCellPainting(DataGridViewCellPaintingEventArgs e)
        {
            base.OnCellPainting(e);
            if (e.ColumnIndex > -1 && e.RowIndex > -1)
            {
                if (this[e.ColumnIndex, e.RowIndex].Value == null || this[e.ColumnIndex, e.RowIndex].Value.Equals(""))
                    this[e.ColumnIndex, e.RowIndex].Style.BackColor = Color.Transparent;
                else
                    this[e.ColumnIndex, e.RowIndex].Style.BackColor = Color.CornflowerBlue;
            }
        }

2. Example

Project: GKeyBank
Source File: kDataGridView.cs
View license
protected override void OnCellPainting(DataGridViewCellPaintingEventArgs e)
        {
            if (e.RowIndex != -1 && e.ColumnIndex != -1)
            {
                if ((CurrentRow != null && e.RowIndex == CurrentRow.Index) || SelectedRowsFromCells.Contains(Rows[e.RowIndex]))
                {
                    Color nextbackcolor = e.CellStyle.BackColor;
                    switch (App.CurrentConfig.Theme)
                    {
                        case Classes.Config.ThemeStyle.LessDark:
                            nextbackcolor = Color.FromArgb(116, 116, 116);
                            break;
                        case Classes.Config.ThemeStyle.Dark:
                            nextbackcolor = Color.FromArgb(84, 84, 84);
                            break;
                        case Classes.Config.ThemeStyle.MoreDark:
                            nextbackcolor = Color.FromArgb(52, 52, 52);
                            break;
                        case Classes.Config.ThemeStyle.TonOfDarkness:
                            nextbackcolor = Color.FromArgb(36, 36, 36);
                            break;
                    }
                    e.CellStyle.BackColor = nextbackcolor;
                    e.CellStyle.ForeColor = Functions.ContrastColor(e.CellStyle.BackColor);

                }
            }
            base.OnCellPainting(e);
        }

3. Example

Project: Krypton
Source File: KryptonDataGridView.cs
View license
protected override void OnCellPainting(DataGridViewCellPaintingEventArgs e)
        {
            IP/n ..... /n //View Source file for more details /n }