【问题标题】:DataGridView Selected Cell Default ColorDataGridView 选定单元格默认颜色
【发布时间】:2013-03-11 01:23:57
【问题描述】:

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

我已经引用了这个site,但是当涉及到提供的颜色时,我似乎不走运。

下面是我所指的颜色。

我觉得一定有办法访问这个属性?但是怎么做?提前感谢您的帮助!

【问题讨论】:

    标签: c# winforms datagridview colors rgb


    【解决方案1】:

    我正在寻找的颜色是:SystemColors.Highlight

    如果您转到 DataGridView 对象的 Properties 部分。有一个名为DefaultCellStyle 的属性,在该属性下有一个名为Appearance 的部分,SelectionBackColor 属性所在的位置。 SelectionBackColor 的默认值是 Highlight,它位于 System.Drawing.SystemColors 之下。

    【讨论】:

      【解决方案2】:

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

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2014-04-05
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2014-10-08
        • 1970-01-01
        • 2013-04-12
        • 2014-02-27
        相关资源
        最近更新 更多