Ejemplo n.º 1
0
        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();
        }
Ejemplo n.º 2
0
        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);
            }
        }
Ejemplo n.º 3
0
        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();
        }
Ejemplo n.º 4
0
        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);
            }
        }
Ejemplo n.º 5
0
 private void OnEndPrint(NPrintDocument sender, NEndPrintEventArgs e)
 {
 }
Ejemplo n.º 6
0
 private void OnBeginPrint(NPrintDocument sender, NBeginPrintEventArgs e)
 {
 }
Ejemplo n.º 7
0
 protected void OnEndPrint(NPrintDocument sender, NEndPrintEventArgs e)
 {
 }
Ejemplo n.º 8
0
 protected void OnBeginPrint(NPrintDocument sender, NBeginPrintEventArgs e)
 {
 }