0

如何在 DataGridViewCheckBoxCell 中获得类似 CheckBox 的控件,在 DataGridViewComboBoxCell 中获得类似的组合框?

foreach (DataGridViewRow row in dgvPerformance.Rows)
{
   DataGridViewCheckBoxCell chk = (DataGridViewCheckBoxCell)row.Cells[6];
   //I need to find CheckBox in chk
}
4

1 回答 1

0

您无法CheckBox从 a 中获取控件DataGridViewCheckBoxCell,但可以获取其值:

foreach (DataGridViewRow row in dgvPerformance.Rows){
   DataGridViewCheckBoxCell chk = row.Cells[6] as DataGridViewCheckBoxCell;

   if(chk != null && (bool)chk.Value){
      //checked, do something
   }
}
于 2013-05-14T12:59:55.980 回答