private void RESAI04I_Shown(object sender, EventArgs e) { if (GV_Main.RowCount == 0) { GV_Main.AddNewRow(); } }
private void GV_Main_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Delete && e.Modifiers == Keys.Control) { if (GV_Main.RowCount > 0 && FocuseRow_Main <= GV_Main.RowCount) { if (MessageBox.Show("確定要刪除此筆資料?", "詢問", MessageBoxButtons.OKCancel) == DialogResult.OK) { IsNowDeleteRow = true; GV_Main.DeleteRow(FocuseRow_Main); GV_Main.RefreshData(); } } } if (GV_Main.IsLastRow) { if (e.KeyData == Keys.Down) { if (!IsGCCHeck) { GV_Main.CloseEditor(); { if (CheckRequiredField()) { if (GV_Main.IsLastRow) { GV_Main.AddNewRow(); } } } } IsGCCHeck = false; } } }
private void GC_Main_MouseClick(object sender, MouseEventArgs e) { if (GV_Main.RowCount == 0) { GV_Main.AddNewRow(); } }
public virtual void BtnNew_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (FGridStatu == GridStatu.gsBrowse) { TabControlMain.SelectedTabPageIndex = 0; BtnNew.Enabled = false; BtnQuery.Enabled = false; BtnEdit.Enabled = false; BtnDel.Enabled = false; BtnFirst.Enabled = false; BtnPrior.Enabled = false; BtnNext.Enabled = false; BtnLast.Enabled = false; BtnSave.Enabled = true; BtnCancel.Enabled = true; btnAutoWidth.Enabled = false; FGridStatu = GridStatu.gsAdd; for (int i = 0; i < MainControls.Count; i++) { MainControls[i].Properties.ReadOnly = false; } DBFillBy(GCNum.GCN_Main, " WHERE 1=2"); GV_Main.AddNewRow(); } }
private void GC_Main_KeyDown(object sender, KeyEventArgs e) { if (GV_Main.IsLastRow) { if (e.KeyData == Keys.Down) { GV_Main.CloseEditor(); IsGCCHeck = true; { if (CheckRequiredField()) { { GV_Main.AddNewRow(); } } } } } }
private void XK006ButtonEdit_ButtonClick(object sender, ButtonPressedEventArgs e) { //if (GetGridStatu() != BaseForm.GridStatu.gsBrowse) { int mRowHandle = GV_Main.FocusedRowHandle; string mType = GV_Main.GetFocusedRowCellValue("XK005").ToString(); f2.SetMI = new string[] { "POSXH", "002" }; //f2.SetMIParam = new string[] { GV_Main.GetFocusedRowCellValue("XK005").ToString(), FData[3], FData[4], FData[3], FData[4] }; //f2.SetMIParam = new string[] { FData[3], FData[4], FData[5], FData[4], FData[5] }; f2.SetMIParam = new string[] { mType, FData[3], FData[4], FData[5] }; f2.SetMuity = true; Dictionary <int, List <string> > muity = null; if (f2.GetMI) { muity = f2.GetMuity; bool IsExist = false; bool IsFirst = true; foreach (KeyValuePair <int, List <string> > s in muity) { for (int i = 0; i < GV_Main.RowCount; i++) { int idx = GV_Main.GetRowHandle(i); if ((GV_Main.GetRowCellValue(idx, "XK006") == null)) { IsExist = false; break; } if (GV_Main.GetRowCellValue(idx, "XK006").ToString() == s.Value[0]) { if (GV_Main.GetRowCellValue(idx, "XK005").ToString() == mType) { if (idx == mRowHandle) { IsFirst = false; } IsExist = true; break; } } } if (IsExist) { IsExist = false; continue; } else { if (IsFirst) { IsFirst = false; } else { GV_Main.AddNewRow(); } int mIndex = GV_Main.RowCount; GV_Main.SetFocusedRowCellValue("XK001", FData[0]); GV_Main.SetFocusedRowCellValue("XK002", FData[1]); GV_Main.SetFocusedRowCellValue("XK003", FData[2]); GV_Main.SetFocusedRowCellValue("XK004", string.Format("{0:0000}", mIndex)); GV_Main.SetFocusedRowCellValue("XK005", mType); GV_Main.SetFocusedRowCellValue("XK006", s.Value[0]); GV_Main.SetFocusedRowCellValue("XK006C", s.Value[1]); GV_Main.SetFocusedRowCellValue("XH004", s.Value[2]); GV_Main.UpdateCurrentRow(); } } } } }