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; } } }
public virtual void BtnDel_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (FGridStatu == GridStatu.gsBrowse) { if (GV_Main.RowCount > 0) { if (MessageBox.Show("確定要刪除此筆資料?", "詢問", MessageBoxButtons.OKCancel) == DialogResult.OK) { GV_Main.DeleteSelectedRows(); GV_Main.RefreshData(); DBUpdate(GCNum.GCN_Main); GC_Main.Refresh(); FGridStatu = GridStatu.gsBrowse; BtnNew.Enabled = true; BtnQuery.Enabled = true; BtnEdit.Enabled = true; BtnDel.Enabled = true; BtnFirst.Enabled = true; BtnPrior.Enabled = true; BtnNext.Enabled = true; BtnLast.Enabled = true; BtnSave.Enabled = false; BtnCancel.Enabled = false; btnAutoWidth.Enabled = true; } } } }
public virtual void BtnCancel_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (FGridStatu != GridStatu.gsBrowse) { FGridStatu = GridStatu.gsBrowse; GV_Main.CancelUpdateCurrentRow(); GV_Main.RefreshData(); for (int i = 0; i < MainControls.Count; i++) { if (MainControls[i].Name.EndsWith("C")) { MainControls[i].Text = ""; } } if (GV_Main.RowCount > 0) { BtnNew.Enabled = true; BtnQuery.Enabled = true; BtnEdit.Enabled = true; BtnDel.Enabled = true; BtnFirst.Enabled = true; BtnPrior.Enabled = true; BtnNext.Enabled = true; BtnLast.Enabled = true; BtnSave.Enabled = false; BtnCancel.Enabled = false; btnAutoWidth.Enabled = true; } else { BtnNew.Enabled = true; BtnQuery.Enabled = true; BtnEdit.Enabled = false; BtnDel.Enabled = false; BtnFirst.Enabled = false; BtnPrior.Enabled = false; BtnNext.Enabled = false; BtnLast.Enabled = false; BtnSave.Enabled = false; BtnCancel.Enabled = false; btnAutoWidth.Enabled = true; } for (int i = 0; i < MainControls.Count; i++) { MainControls[i].Enabled = true; MainControls[i].Properties.ReadOnly = true; } } }
private void GC_Main_EditorKeyDown(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(); } } } else if (e.KeyCode == Keys.F2) { if (F2FieldBody.Contains(GV_Main.FocusedColumn.FieldName)) { ButtonEdit edit = (GV_Main.ActiveEditor as ButtonEdit); EditorButton eb = ((RepositoryItemButtonEdit)GV_Main.FocusedColumn.ColumnEdit).Buttons[0]; PerformClick(GV_Main.FocusedColumn.FieldName, edit, new ButtonPressedEventArgs(eb)); } } }