private void chkListband() { if (isListband == true) { string printer = ""; frmSelectCopy frm = new frmSelectCopy(); int copyNum = frm.loadSelectCopyFrm(qtyBarcode); if (copyNum > 0) { foreach (ReportDocument rptDoc in listRpt) { try { if (string.IsNullOrEmpty(frm.PrinterName)) { printer = printBarcodeName; } else { printer = frm.PrinterName; } if (Report.CheckPrinterClass.hasPrinter(printer)) { rptDoc.PrintOptions.PrinterName = printer; rptDoc.PrintOptions.PaperOrientation = PaperOrientation.Landscape; var pt = new System.Drawing.Printing.PrintDocument(); pt.PrinterSettings.PrinterName = printer; //foreach (System.Drawing.Printing.PaperSize pa in pt.PrinterSettings.PaperSizes) //{ // if (pa.PaperName == papername) // { // rptDoc.PrintOptions.PaperSize = (PaperSize)((int)pa.Kind); // break; // } //} rptDoc.PrintOptions.DissociatePageSizeAndPrinterPaperSize = true; rptDoc.PrintToPrinter(copyNum, false, 0, 0); } else { MessageBox.Show("Printer is not found."); } } catch (Exception) { } } } } }
private void activateForShowCopy(object sender, EventArgs e) { this.Activated -= new EventHandler(activateForShowCopy); if (_propReport.defaultCopy == null) { _propReport.defaultCopy = qtyBarcode; } if (_propReport.defaultCopy == null) { // "Connect Database Error."; } else { frmSelectCopy frm = new frmSelectCopy(); int copy = frm.loadSelectCopyFrm(Convert.ToInt32(_propReport.defaultCopy)); if (copy > 0) { string message = printReport(copy, frm.PrinterName, frm.PaperName); } } }