【问题标题】:DataGridView column with buttons for only some entries?带有按钮的 DataGridView 列仅用于某些条目?
【发布时间】:2023-03-25 11:30:01
【问题描述】:

我有一个DataGridView,它需要为每行包含数据的删除按钮:某些行可能没有数据。 DataGridViewButtonColumn 似乎在每个单元格中都放置了一个按钮,我还没有找到一种方法来隐藏(甚至禁用)某些按钮。

有没有办法做到这一点?

【问题讨论】:

    标签: c# .net datagridview datagridviewcolumn


    【解决方案1】:

    看起来有点小技巧...但您也许可以“删除”某些行上的按钮... 见:Datagridview, disable button/row

    Dim cell As DataGridViewButtonCell = dgv.row(x).cell(y)
    cell = New DataGridViewTextBoxCell()
    cell.value = String.Empty
    cell.ReadOnly = True
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-06-11
      • 2018-04-12
      • 2021-12-16
      • 1970-01-01
      • 2018-12-13
      • 1970-01-01
      • 2015-06-26
      相关资源
      最近更新 更多