获取与取消选择的因子列表 GrdiView

/// <summary>
/// 获取选择的因子列表
/// </summary>
/// <returns></returns>
private List<GradualDecomposeFactor> GetCheckedFactors()
{
 List<GradualDecomposeFactor> result = new List<GradualDecomposeFactor>();
 foreach (DataGridViewRow row in factorGrid.Rows)
 {
  object o = row.Cells[colCheck.Index].Value;
  if (o == null) continue;
  if ((bool)o != true) continue;
  GradualDecomposeFactor item = row.Tag as GradualDecomposeFactor;
  result.Add(item);
 }

 return result;
}

 

取消:

/// <summary>
/// 取消因子的选择
/// </summary>
private void ClearCheckedFactors()
{
 foreach (DataGridViewRow row in factorGrid.Rows)
  row.Cells[colCheck.Index].Value = false;
}

posted @ 2011-10-13 14:49  pnljs  阅读(167)  评论(0编辑  收藏  举报