/// <summary> /// 编辑完成 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Dgv_QiDong_CellLeave(object sender, DataGridViewCellEventArgs e) { if (!Dgv_QiDong[e.ColumnIndex, e.RowIndex].ReadOnly) { if (Dgv_QiDong[e.ColumnIndex, e.RowIndex].Value == null) { Dgv_QiDong.EndEdit(); return; } string _TmpValue = Dgv_QiDong[e.ColumnIndex, e.RowIndex].Value.ToString(); Dgv_QiDong.EndEdit(); if (e.ColumnIndex != 4) { if (Dgv_QiDong[e.ColumnIndex, e.RowIndex].Value == null && Dgv_QiDong[e.ColumnIndex, e.RowIndex].Value.ToString() == string.Empty) { Dgv_QiDong[e.ColumnIndex, e.RowIndex].Value = "0"; } else if (!CLDC_DataCore.Function.Number.IsNumeric(Dgv_QiDong[e.ColumnIndex, e.RowIndex].Value.ToString())) { Dgv_QiDong[e.ColumnIndex, e.RowIndex].Value = _TmpValue; return; } } if (e.ColumnIndex == 1) { StPlan_QiDong _Item = (StPlan_QiDong)_DnbGroup.CheckPlan[(int)Dgv_QiDong.Rows[e.RowIndex].Tag]; _Item.FloatxIb = float.Parse(Dgv_QiDong[e.ColumnIndex, e.RowIndex].Value.ToString()); _Item.CheckTimeAndIb(_GuiCheng, _Clfs, _Ub, _Ib, _Dj, _Const, _Znq, _Hgq); Dgv_QiDong[2, e.RowIndex].Value = _Item.FloatIb; Dgv_QiDong[3, e.RowIndex].Value = _Item.CheckTime; Dgv_QiDong[3, e.RowIndex].Tag = Dgv_QiDong[3, e.RowIndex].Value; } } }
/// <summary> /// 编辑可以编辑的单元格 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Dgv_QiDong_CellClick(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex == -1 || e.RowIndex == -1) { return; } if (!Dgv_QiDong[e.ColumnIndex, e.RowIndex].ReadOnly) { Dgv_QiDong.BeginEdit(true); } }