コード例 #1
0
ファイル: OptionDialog.cs プロジェクト: huamanhtuyen/VNACCS
 private void btnDefaultPrinter_Click(object sender, EventArgs e)
 {
     PrinterSettings settings = new PrinterSettings();
     if (!settings.IsValid)
     {
         MessageDialog dialog = new MessageDialog();
         dialog.ShowMessage("E607", "");
         dialog.Close();
         dialog.Dispose();
     }
     else
     {
         PrinterTrayDlg dlg = null;
         try
         {
             dlg = new PrinterTrayDlg();
             if (dlg.ShowDialog() == DialogResult.OK)
             {
                 this.txbDefaultPrinter.Text = dlg.PrinterSettings.PrinterName;
                 this.txbDefaultBin.Text = dlg.PrinterSettings.DefaultPageSettings.PaperSource.SourceName;
                 this.default_binno = dlg.PrinterSettings.DefaultPageSettings.PaperSource.RawKind;
                 if (!this.IsEntryPrinter(dlg.PrinterSettings.PrinterName))
                 {
                     this.GetPrinterInfo(dlg.PrinterSettings);
                     this.tbpPrinter_Refresh();
                 }
             }
         }
         catch (Exception exception)
         {
             MessageDialog dialog2 = new MessageDialog();
             dialog2.ShowMessage("E611", dlg.PrinterSettings.PrinterName, null, exception);
             dialog2.Close();
             dialog2.Dispose();
         }
     }
 }
コード例 #2
0
ファイル: OptionDialog.cs プロジェクト: huamanhtuyen/VNACCS
 private void btnEntryPrtAdd_Click(object sender, EventArgs e)
 {
     if (this.prtInfoList.Count >= 0x63)
     {
         this.ShowModelessMessage("E548", null, null);
     }
     else
     {
         PrinterSettings settings = new PrinterSettings();
         if (!settings.IsValid)
         {
             MessageDialog dialog = new MessageDialog();
             dialog.ShowMessage("E607", "");
             dialog.Close();
             dialog.Dispose();
         }
         else
         {
             PrinterTrayDlg dlg = null;
             try
             {
                 dlg = new PrinterTrayDlg();
                 if (dlg.ShowDialog() == DialogResult.OK)
                 {
                     if (this.IsEntryPrinter(dlg.PrinterSettings.PrinterName))
                     {
                         this.ShowModelessMessage("E549", null, null);
                     }
                     else
                     {
                         this.GetPrinterInfo(dlg.PrinterSettings);
                         if (string.IsNullOrEmpty(this.txbDefaultPrinter.Text))
                         {
                             this.txbDefaultPrinter.Text = dlg.PrinterSettings.PrinterName;
                             this.txbDefaultBin.Text = dlg.PrinterSettings.DefaultPageSettings.PaperSource.SourceName;
                             this.default_binno = dlg.PrinterSettings.DefaultPageSettings.PaperSource.RawKind;
                         }
                         this.tbpPrinter_Refresh();
                     }
                 }
             }
             catch (Exception exception)
             {
                 MessageDialog dialog2 = new MessageDialog();
                 dialog2.ShowMessage("E611", dlg.PrinterSettings.PrinterName, null, exception);
                 dialog2.Close();
                 dialog2.Dispose();
             }
         }
     }
 }
コード例 #3
0
ファイル: OptionDialog.cs プロジェクト: huamanhtuyen/VNACCS
 private void dgvAutoPrint_CellClick(DataGridView dgv)
 {
     PrinterSettings settings = new PrinterSettings();
     if (!settings.IsValid)
     {
         MessageDialog dialog = new MessageDialog();
         dialog.ShowMessage("E607", "");
         dialog.Close();
         dialog.Dispose();
     }
     else
     {
         DataGridViewRow currentRow = dgv.CurrentRow;
         PrinterTrayDlg dlg = null;
         try
         {
             short num;
             dlg = new PrinterTrayDlg();
             if (short.TryParse(currentRow.Cells[this.cAPCount.Index].Value.ToString(), out num))
             {
                 settings.Copies = num;
             }
             dlg.PrinterSettings = settings;
             if (dlg.ShowDialog() == DialogResult.OK)
             {
                 if (this.IsEntryPrinter(dlg.PrinterSettings.PrinterName))
                 {
                     currentRow.Cells[this.cAPPrinter.Index].Value = dlg.PrinterSettings.PrinterName;
                     currentRow.Cells[this.cAPBinName.Index].Value = dlg.PrinterSettings.DefaultPageSettings.PaperSource.SourceName;
                     currentRow.Cells[this.cAPBinNo.Index].Value = dlg.PrinterSettings.DefaultPageSettings.PaperSource.RawKind;
                     if (dlg.PrinterSettings.Copies > 0x63)
                     {
                         currentRow.Cells[this.cAPCount.Index].Value = 0x63;
                     }
                     else
                     {
                         currentRow.Cells[this.cAPCount.Index].Value = dlg.PrinterSettings.Copies;
                     }
                 }
                 else
                 {
                     this.ShowModelessMessage("E553", null, null);
                 }
             }
         }
         catch (Exception exception)
         {
             MessageDialog dialog2 = new MessageDialog();
             dialog2.ShowMessage("E611", dlg.PrinterSettings.PrinterName, null, exception);
             dialog2.Close();
             dialog2.Dispose();
         }
     }
 }