有谁知道 DataGridView 的选定单元格背景颜色的 RGB 代码。我目前正在尝试使某些单元格看起来是空白的,直到满足某个条件。处理“未选择”ForeColor很容易,因为它只需要Color.White. 但处理SelectionForeColor并不是最简单的。我找到的最接近的默认颜色是Color.DodgerBlue.
我已经引用了这个网站,但在提供的颜色方面,我似乎不走运。
下面是我指的颜色。

我觉得必须有一种方法可以访问此属性?但是怎么做?提前感谢您的帮助!
我正在寻找的颜色是:SystemColors.Highlight。
如果你去你的对象的Properties部分。DataGridView有一个名为的属性,在该属性DefaultCellStyle下有一个名为Appearance该SelectionBackColor属性所在的部分。的默认值SelectionBackColor是Highlight在System.Drawing.SystemColors.
一个可以尝试的属性是DataGridView.RowsDefaultCellStyle.SelectionBackColor,尽管您可能更感兴趣DataGridViewCell.InheritedStyle.SelectionBackColor。