【问题标题】:DataGridView row text disappears on every row except the selected oneDataGridView 行文本在除所选行之外的每一行上消失
【发布时间】:2014-02-16 07:35:58
【问题描述】:

只有选定行的文本出现在 DataGridView 上。我尝试通过 DataTable 添加行并设置数据源,然后将行直接添加到 gridview。

dgvCudaMiner_Failover.Rows.Add(object.property1.ToString(), object.property2, object.property3, object.property4, true, object.property5.ToString());

对正在发生的事情有任何想法吗?我尝试将所有列更改为文本列以查看是否可行,但没有。

【问题讨论】:

  • 是否有可能将单元格的前景色设置为与背景相同的颜色? The text is actually there, but you can't see it until background color changed to blue (which happen when a row selected)
  • @har07 谢谢!这就是问题所在。由于某种原因,DefaultCellStyle 属性的 ForeColor 全部搞砸了。请将此作为答案提交,以便我接受。

标签: c# winforms datagridview


【解决方案1】:

将我的评论转换为按要求回答。

我怀疑,单元格的前景色设置为与背景相同的颜色。 The text is actually there, but you can't see it until background color changed to blue (which happen when a row selected)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2023-04-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多