DataGrid与已datasource
和checked
值的unchecked
绑定。我必须禁用其值已选中的按钮。
private void disableManualBuyButtons()
{
foreach (DataGridViewRow row in gvViewTickets.Rows)
{
DataGridViewCheckBoxCell cbc = (DataGridViewCheckBoxCell)row.Cells[0];
cbc.TrueValue = true;
if (cbc.Value.Equals(cbc.TrueValue))
{
DataGridViewButtonCell btn = (DataGridViewButtonCell)row.Cells[8];
btn.ReadOnly = true;
}
}
}
答案 0 :(得分:1)
根据this文章:
DataGridView控件包含DataGridViewButtonCell类,用于显示具有用户界面(UI)的单元格,如按钮。但是,DataGridViewButtonCell不提供禁用单元格显示按钮外观的方法。
文章建议的解决方法是创建自己的列。你会在文章中找到完整的代码。