Пример #1
0
 /// <summary>
 /// Form keydown for Quick access
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void frmSalesOrder_KeyDown(object sender, KeyEventArgs e)
 {
     try
     {
         if (e.KeyCode == Keys.Escape)
         {
             if (PublicVariables.isMessageClose)
             {
                 Messages.CloseMessage(this);
             }
             else
             {
                 this.Close();
             }
         }
         //.........................................CTRL+S............................//
         if (e.KeyCode == Keys.S && Control.ModifierKeys == Keys.Control)//save or edit 
         {
             cmbCashOrParty.Focus();
             if (cmbCashOrParty.Focused)
             {
                 cmbCashOrParty.DropDownStyle = ComboBoxStyle.DropDown;
             }
             else
             {
                 cmbCashOrParty.DropDownStyle = ComboBoxStyle.DropDownList;
             }
             btnSave_Click(sender, e);
         }
         //.........................................CTRL+D............................//
         if (e.KeyCode == Keys.D && Control.ModifierKeys == Keys.Control)//Delete 
         {
             if (btnDelete.Enabled)
             {
                 if (cmbCashOrParty.Focused)
                 {
                     cmbCashOrParty.DropDownStyle = ComboBoxStyle.DropDown;
                 }
                 else
                 {
                     cmbCashOrParty.DropDownStyle = ComboBoxStyle.DropDownList;
                 }
                 btnDelete_Click(sender, e);
             }
         }
         if (e.KeyCode == Keys.C && Control.ModifierKeys == Keys.Alt) //Product Creation
         {
             if (dgvSalesOrder.CurrentCell != null)
             {
                 if (dgvSalesOrder.CurrentCell == dgvSalesOrder.CurrentRow.Cells["dgvtxtProductName"] || dgvSalesOrder.CurrentCell == dgvSalesOrder.CurrentRow.Cells["dgvtxtProductCode"])
                 {
                     SendKeys.Send("{F10}");
                     if (dgvSalesOrder.Columns[dgvSalesOrder.CurrentCell.ColumnIndex].Name == "dgvtxtProductName" || dgvSalesOrder.Columns[dgvSalesOrder.CurrentCell.ColumnIndex].Name == "dgvtxtProductCode")
                     {
                         frmProductCreation frmProductCreationObj = new frmProductCreation();
                         frmProductCreationObj.MdiParent = formMDI.MDIObj;
                         frmProductCreationObj.CallFromSalesOrder(this);
                     }
                 }
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("SO86:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }