【发布时间】:2013-06-08 04:46:54
【问题描述】:
我有两个 ckecboxes(错误和启用)如下
如果我取消选中“启用”复选框,相应的“错误”复选框将变为灰色。
我尝试如下,但没有启用或禁用属性
void dgRulesMaster_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
if (e.RowIndex > -1 & e.ColumnIndex == 3)
{
var editingCellFormattedValue = Convert.ToBoolean(((DataGridViewCheckBoxCell)dgRulesMaster.Rows[dgRulesMaster.CurrentRow.Index].Cells[3]).EditingCellFormattedValue);
if (editingCellFormattedValue == false)
{
dgRulesMaster[2, e.RowIndex].ReadOnly = true;
}
}
}
【问题讨论】:
-
您的代码是否包含在
if语句中?DataGridViewCheckBoxCell是否有Checked属性?
标签: c# winforms datagridviewcolumn datagridviewlinkcolumn