简体   繁体   中英

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.

在此处输入图片说明

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

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 .

可以尝试的一个属性是DataGridView.RowsDefaultCellStyle.SelectionBackColor ,尽管您可能对DataGridViewCell.InheritedStyle.SelectionBackColor更感兴趣。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM