有人知道DataGridView选择单元格背景颜色的RGB代码吗? 我目前正在尝试使某些单元格看起来为空,直到满足某个条件为止。 处理“未选定”ForeColor很容易,因为它只需要Color.White。 但是处理SelectionForeColor并不是很容易。 我找到的最接近默认颜色是Color.DodgerBlue。
我引用了这个网站,但似乎没有提供所需的颜色。
下面是我参考的颜色。
我感觉一定有办法访问此属性? 但如何呢? 感谢您提前提供任何帮助!
SystemColors.Highlight
。DataGridView
对象的Properties
部分,有一个名为DefaultCellStyle
的属性,在该属性下有一个名为Appearance
的部分,其中包含SelectionBackColor
属性。 SelectionBackColor
的默认值是Highlight
,位于System.Drawing.SystemColors
下。尝试使用DataGridView.RowsDefaultCellStyle.SelectionBackColor
属性,但您可能更感兴趣的是DataGridViewCell.InheritedStyle.SelectionBackColor
。