1
/// <summary>
2 /// 实现DataGridView控件中CheckBox列的使用
3 /// </summary>
4 /// <param name="sender"></param>
5 /// <param name="e"></param>
6 private void dgvTradList_CellContentClick(
object sender, DataGridViewCellEventArgs e)
7 {
8 if (e.ColumnIndex ==
0 && e.RowIndex != -
1)
9 {
10 if ((
bool)dgvTradList.Rows[e.RowIndex].Cells[
0].EditedFormattedValue ==
true)
11 {
12 dgvTradList.Rows[e.RowIndex].Cells[
0].Value =
false;
13 }
14 else15 {
16 dgvTradList.Rows[e.RowIndex].Cells[
0].Value =
true;
17 }
18 }