Example #1
0
 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;
         }
     }
 }
Example #2
0
        private void btnDelAll_Click(object sender, EventArgs e)
        {
            int i = 0;

            while (i < GV_Main.RowCount)
            {
                GV_Main.DeleteRow(i);
            }
        }
Example #3
0
        private void btnDelOne_Click(object sender, EventArgs e)
        {
            int i = 0;

            while (i < GV_Main.RowCount)
            {
                if (GV_Main.GetRowCellValue(i, "Select").ToString() == "Y")
                {
                    GV_Main.DeleteRow(i);
                }
                else
                {
                    i++;
                }
            }
        }
Example #4
0
 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));
         }
     }
 }