Пример #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();
        }
Пример #2
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();
        }