解决办法一:
1.设置DataGridView控件的ReadOnly属性为true。
目的是设置DataGridView控件不可编辑。
2.在代码中实现
1 #region 单击选择 2 private void dgvxCtnPOC_CellClick(object sender, DataGridViewCellEventArgs e) 3 { 4 if (e.RowIndex == -1) 5 return; 6 else 7 { 8 this.dgvxCtnPOC["选择", e.RowIndex].Value = (this.dgvxCtnPOC["选择", e.RowIndex].Value == null || this.dgvxCtnPOC["选择", e.RowIndex].Value.ToString().ToLower() == "false") ? true : false; 9 } 10 } 11 #endregion
这样就实现了,可以勾选DataGridView控件行,但是DataGridView控件又不可以编辑。
效果如果:

浙公网安备 33010602011771号