Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

DataGridView Selected Cell Default Color

Does anyone know the RGB code of DataGridView's selected cell background color. I'm currently trying to make certain cells appear to be blank until a certain condition is satisfied. Handling the 'unselected' ForeColor was easy as all it required was Color.White. But handling the SelectionForeColor has not been the easiest. The closest default color that I have found is Color.DodgerBlue.

I've referenced this site, but it appears that I am out of luck when it comes to a provided color.

Below is the color that I am referring to.

enter image description here

I feel that there must be a way to access this property? But how? Thanks in advance for any help!

like image 881
Derek W Avatar asked Mar 21 '13 13:03

Derek W


Video Answer


1 Answers

The color that I was looking for was: SystemColors.Highlight.

If you go to the Properties section of your DataGridView object. There is a property called DefaultCellStyle and under that there is a section called Appearance where the SelectionBackColor property resides. The default for SelectionBackColor is Highlight which is under System.Drawing.SystemColors.

like image 142
Derek W Avatar answered Sep 20 '22 08:09

Derek W