winform中DataGridView使用DataGridViewCheckBoxColumn实现RadioBox单选功能
private void dgvMaterial_CellContentClick(object sender, DataGridViewCellEventArgs e) { for (int i = 0; i < dgvMaterial.Rows.Count; i++) { DataGridViewCheckBoxCell ck = dgvMaterial.Rows[i].Cells[0] as DataGridViewCheckBoxCell; if (i != e.RowIndex) { ck.Value = false; } else { ck.Value = true; } } }