DataGridView changing cell background color

Simply create a new DataGridViewCellStyle object, set its back color and then assign the cell’s style to it:

    DataGridViewCellStyle style = new DataGridViewCellStyle();
    style.BackColor = Color.FromArgb(((GesTest.dsEssais.FMstatusAnomalieRow)row.DataBoundItem).iColor);
    style.ForeColor = Color.Black;
    row.Cells[color.Index].Style = style;

Leave a Comment