/// <summary> /// 取消計算 /// </summary> public void ResetCalcuteType() { DoCalculate = CalcuteType.None; var checkIdx = 0; foreach (var row in _GridViewContainer.Rows.Cast<DataGridViewRow>() .Where(p => Convert.ToBoolean(p.Cells[checkIdx].Value) == true) .ToArray()) { row.Cells[checkIdx].Value = false; } _GridViewContainer.Columns[checkIdx].Visible = false; }
/// <summary> /// 設定計算類型 /// </summary> /// <param name="cType"></param> public void SetCalcuteType(CalcuteType cType) { DoCalculate = cType; _GridViewContainer.Columns[0].Visible = !(DoCalculate == CalcuteType.None); }
/// <summary> /// 回復 GridView 的狀態 /// <para>取消 Checkbox</para> /// </summary> /// <param name="columnIndex"></param> /// <param name="gridView"></param> /// <param name="checkRows"></param> private void restoreGridviewState(int columnIndex, DataGridView gridView, DataGridViewRow[] checkRows) { DoCalculate = CalcuteType.None; foreach (var item in checkRows) { item.Cells[columnIndex].Value = false; } gridView.Columns[0].Visible = false; }