获取与取消选择的因子列表 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;
}