Пример #1
0
 protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
 {
     if (keyData == (Keys.Control | Keys.Enter))
     {
         if (this.printButton.Enabled)
         {
             this.Cursor = System.Windows.Forms.Cursors.WaitCursor;
             try
             {
                 PrintingList itemPrintList = new PrintingList(this.itemListForPrint, this.printerListComboBox.SelectedItem.ToString());
                 this.discriptionListBox.Visible = false;
                 this.discriptionLabel.Visible   = false;
                 this.barcodePanel.Controls.Clear();
                 this.barCodeTextBox.Focus();
                 GC.Collect();
             }
             catch (Exception ex)
             {
                 MessageBox.Show(this, ex.Message, "Operation failed.", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
             this.Cursor = System.Windows.Forms.Cursors.Default;
         }
         else
         {
             MessageBox.Show("Select Items.", "Message.", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         }
         return(true);
     }
     return(base.ProcessCmdKey(ref msg, keyData));
 }
Пример #2
0
 private void printButton_Click(object sender, EventArgs e)
 {
     this.Cursor = System.Windows.Forms.Cursors.WaitCursor;
     try
     {
         PrintingList itemPrintList = new PrintingList(this.itemListForPrint, this.printerListComboBox.SelectedItem.ToString());
         this.discriptionListBox.Visible = false;
         this.discriptionLabel.Visible   = false;
         this.barcodePanel.Controls.Clear();
         this.barCodeTextBox.Focus();
         GC.Collect();
     }
     catch (Exception ex)
     {
         MessageBox.Show(this, ex.Message, "Operation failed.", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     this.Cursor = System.Windows.Forms.Cursors.Default;
 }