private void OnPrintButtonClick(NEventArgs args) { NPrintDocument printDocument = new NPrintDocument(); printDocument.DocumentName = "Test Document 1"; printDocument.BeginPrint += new Function <NPrintDocument, NBeginPrintEventArgs>(OnBeginPrint); printDocument.PrintPage += new Function <NPrintDocument, NPrintPageEventArgs>(OnPrintPage); printDocument.EndPrint += new Function <NPrintDocument, NEndPrintEventArgs>(OnEndPrint); NPrintDialog pd = new NPrintDialog(); pd.EnableCustomPageRange = true; pd.EnableCurrentPage = true; pd.PrintRangeMode = ENPrintRangeMode.AllPages; pd.CustomPageRange = new NRangeI(1, 100); pd.NumberOfCopies = 2; pd.Collate = true; pd.PrintDocument = printDocument; pd.Closed += new Function <NPrintDialogResult>(OnPrintDialogClosed); pd.RequestShow(); }
private void OnPrintPage(NPrintDocument sender, NPrintPageEventArgs e) { NSize pageSizeDIP = new NSize(this.Width, this.Height); try { NMargins pageMargins = NMargins.Zero; NRegion clip = NRegion.FromRectangle(new NRectangle(0, 0, e.PrintableArea.Width, e.PrintableArea.Height)); NMatrix transform = new NMatrix(e.PrintableArea.X, e.PrintableArea.Y); NPaintVisitor visitor = new NPaintVisitor(e.Graphics, 300, transform, clip); // forward traverse the display tree this.OwnerWindow.VisitDisplaySubtree(visitor); e.HasMorePages = false; } catch (Exception x) { NMessageBox.Show(x.Message, "Exception", ENMessageBoxButtons.OK, ENMessageBoxIcon.Error); } }
protected void OnPrintMenuItemClick(NEventArgs args) { Random rand = new Random(); NPrintDocument printDocument = new NPrintDocument(); printDocument.DocumentName = "T:" + rand.Next().ToString(); printDocument.BeginPrint += new Function <NPrintDocument, NBeginPrintEventArgs>(OnBeginPrint); printDocument.PrintPage += new Function <NPrintDocument, NPrintPageEventArgs>(OnPrintPage); printDocument.EndPrint += new Function <NPrintDocument, NEndPrintEventArgs>(OnEndPrint); NPrintDialog pd = new NPrintDialog(); pd.EnableCustomPageRange = true; pd.EnableCurrentPage = true; pd.PrintRangeMode = ENPrintRangeMode.AllPages; pd.CustomPageRange = new NRangeI(1, 100); pd.NumberOfCopies = 1; pd.Collate = true; pd.PrintDocument = printDocument; pd.RequestShow(); }
protected void OnPrintPage(NPrintDocument sender, NPrintPageEventArgs e) { NSize pageSizeDIP = new NSize(this.Width, this.Height); try { double clipW = e.PrintableArea.Width; double clipH = e.PrintableArea.Height; NRegion clip = NRegion.FromRectangle(new NRectangle(0, 0, clipW, clipH)); NMatrix transform = new NMatrix(e.PrintableArea.X, e.PrintableArea.Y); NPaintVisitor visitor = new NPaintVisitor(e.Graphics, 300, transform, clip); // forward traverse the display tree VisitDisplaySubtree(visitor); e.HasMorePages = false; } catch (Exception ex) { NMessageBox.Show(null, ex.Message, "Exception", ENMessageBoxButtons.OK, ENMessageBoxIcon.Error); } }
private void OnEndPrint(NPrintDocument sender, NEndPrintEventArgs e) { }
private void OnBeginPrint(NPrintDocument sender, NBeginPrintEventArgs e) { }
protected void OnEndPrint(NPrintDocument sender, NEndPrintEventArgs e) { }
protected void OnBeginPrint(NPrintDocument sender, NBeginPrintEventArgs e) { }