Ejemplo n.º 1
0
 public void PrintRTF(PrintDocument printDocument, bool preview)
 {
     try
     {
         printDocument.BeginPrint += new PrintEventHandler(this.method_0);
         printDocument.EndPrint   += new PrintEventHandler(this.method_2);
         printDocument.PrintPage  += new PrintPageEventHandler(this.method_1);
         CoolPrintPreviewDialog dialog = new CoolPrintPreviewDialog {
             Document = printDocument
         };
         if (preview)
         {
             if (dialog.ShowDialog() == DialogResult.OK)
             {
                 printDocument.Print();
             }
         }
         else
         {
             printDocument.Print();
         }
     }
     catch (Exception exception)
     {
         Trace.WriteLine(exception.Message);
     }
 }
        public void PrintRTF(PrintDocument printDocument, bool preview)
        {
            try
            {
                printDocument.BeginPrint += new System.Drawing.Printing.PrintEventHandler(this.printDocument_BeginPrint);
                printDocument.EndPrint   += new System.Drawing.Printing.PrintEventHandler(this.printDocument_EndPrint);
                printDocument.PrintPage  += new System.Drawing.Printing.PrintPageEventHandler(this.printDocument_PrintPage);

                CoolPrintPreviewDialog dlg = new CoolPrintPreviewDialog();
                dlg.Document = printDocument;
                if (preview)
                {
                    if (dlg.ShowDialog() == DialogResult.OK)
                    {
                        printDocument.Print();
                    }
                }
                else
                {
                    printDocument.Print();
                }
            }
            catch (Exception ex)
            {
                Trace.WriteLine(ex.Message);
            }
        }
Ejemplo n.º 3
0
 public ImagePrintHelper(Image image, string documentname)
 {
     this.printDocument_0          = new PrintDocument();
     this.printDialog_0            = new PrintDialog();
     this.coolPrintPreviewDialog_0 = new CoolPrintPreviewDialog();
     this.AllowPrintCenter         = true;
     this.AllowPrintRotate         = true;
     this.AllowPrintEnlarge        = true;
     this.AllowPrintShrink         = true;
     this.image_0 = (Image)image.Clone();
     this.printDialog_0.UseEXDialog         = true;
     this.printDocument_0.DocumentName      = documentname;
     this.printDocument_0.PrintPage        += new PrintPageEventHandler(this.printDocument_0_PrintPage);
     this.printDialog_0.Document            = this.printDocument_0;
     this.coolPrintPreviewDialog_0.Document = this.printDocument_0;
 }
Ejemplo n.º 4
0
        public void PrintRTF(PrintDocument printDocument, bool preview)
        {
            try
            {
                printDocument.BeginPrint += new System.Drawing.Printing.PrintEventHandler(this.printDocument_BeginPrint);
                printDocument.EndPrint += new System.Drawing.Printing.PrintEventHandler(this.printDocument_EndPrint);
                printDocument.PrintPage += new System.Drawing.Printing.PrintPageEventHandler(this.printDocument_PrintPage);

                CoolPrintPreviewDialog dlg = new CoolPrintPreviewDialog();
                dlg.Document = printDocument;
                if (preview)
                {
                    if (dlg.ShowDialog() == DialogResult.OK)
                    {
                        printDocument.Print();
                    }
                }
                else
                {
                    printDocument.Print();
                }
            }
            catch (Exception ex)
            {
                Trace.WriteLine(ex.Message);
            }
        }