Search code examples
datagridviewdatagridviewcomboboxcell

How can I change the color of a DataGridViewComboBoxCell in the CellFormatting event?


private void CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
{
  if(whatever)
    e.CellStyle.BackColor = SystemColors.ControlDark;

This works fine for text columns but for combo box columns it makes no difference. I'd just as soon not make an owner draw control if there's a simpler way to do this.

Thanks, Spike


Solution

  • I've searched my programs layout manager code looking for everything that is connected to DGV combobox columns and only BackColor and SelectionBackColor are set. If it changes anything we have style set to flat and this is working well(col.FlatStyle = FlatStyle.Flat).