How to find the DataGridViewCell background color in C# - windows application?
+1
A:
Saw this on bytes.com, and another user claims it works, though I have not tested it (this is VB):
DataGridView1.Item(ColumnIndex, RowIndex).Style.BackColor = Color
or
DataGridView1.CurrentCell.Style.BackColor = Color
Also see the MSDN documentation:
http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridviewcell.style.aspx
Cory Larson
2009-04-02 13:05:03
A:
If you need this information in order to alter the rendering of the cell, you could plug to the Paint or the Formatting event, which EventArgs has a CellStyle property with the background color inside.
Guulh
2009-04-02 13:55:31