Ejemplo n.º 1
0
 /// <summary>
 /// For shortcut keys
 /// Esc for form close
 /// ctrl+s for save
 /// ctrl+d for delete
 /// alt+c for product creation
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void frmSalesQuotation_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 
         {
             
             btnSave_Click(sender, e);
         }
         //.........................................CTRL+D............................//
         if (e.KeyCode == Keys.D && Control.ModifierKeys == Keys.Control)//Delete 
         {
             
             if (btnDelete.Enabled == true)
             {
                 btnDelete_Click(sender, e);
             }
         }
         if (e.KeyCode == Keys.C && Control.ModifierKeys == Keys.Alt) //Product Creation
         {
             if (dgvProduct.CurrentCell != null)
             {
                 if (dgvProduct.CurrentCell == dgvProduct.CurrentRow.Cells["dgvtxtProductName"] || dgvProduct.CurrentCell == dgvProduct.CurrentRow.Cells["dgvtxtProductCode"])
                 {                         
                     if (dgvProduct.Columns[dgvProduct.CurrentCell.ColumnIndex].Name == "dgvtxtProductName" || dgvProduct.Columns[dgvProduct.CurrentCell.ColumnIndex].Name == "dgvtxtProductCode")
                     {
                         SendKeys.Send("{F10}");
                         frmProductCreation frmProductCreationObj = new frmProductCreation();
                         frmProductCreationObj.MdiParent = formMDI.MDIObj;
                         frmProductCreationObj.CallFromSalesQuotation(this);
                     }
                 }
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("SQ:68" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }