public void PrintPreview()
 {
     this.CreatePrintDocument();
     using (System.Windows.Forms.PrintPreviewDialog dlg = new System.Windows.Forms.PrintPreviewDialog())
     {
         dlg.Document = this._printDoc;
         dlg.ShowDialog(this.FindForm());
     }
 }
        //Druck-Funktion, die den StandardPrintDialog aufruft
        public void drucken(bool erfuellung, bool gewichtung, bool nutzwert, bool prozent, int ProjektID, int[] ProduktID, bool produkte)
        {
            dok.BuildDataTable(erfuellung: false, anforderungen: true, gewichtung: gewichtung, nutzwert: nutzwert, prozent: prozent, ProjektID: ProjektID, ProduktID: ProduktID, db: db, produkte: produkte);

            System.Windows.Forms.PrintPreviewDialog dialog = new System.Windows.Forms.PrintPreviewDialog();
            dialog.Document = dok;

            dialog.ShowDialog();
        }
Exemple #3
0
        public void PrintReceipt(bool giftReceipt, ArrayList currentCart)
        {
            arCart = currentCart;

            PrintDocument recordDoc;

            // Create the document and name it
            recordDoc = new PrintDocument();
            recordDoc.DocumentName = "Customer Receipt";
            recordDoc.DefaultPageSettings.Landscape = false;

            if (giftReceipt)
            {
                recordDoc.PrintPage += new PrintPageEventHandler(this.printGiftReceiptPage);
            }
            else
            {
                recordDoc.PrintPage += new PrintPageEventHandler(this.printReceipt);
            }

            PaperSize paperSize = null;

            switch (receiptWidth)
            {
            case (30):    //new thermal printer
                paperSize = new PaperSize("Receipt", 230, 1100);
                break;

            default:
                paperSize = new PaperSize("Receipt", 275, 1100);
                break;
            }

            recordDoc.DefaultPageSettings.PaperSize = paperSize;

            Margins margins = new Margins(5, 8, 5, 5);

            recordDoc.DefaultPageSettings.Margins = margins;
            recordDoc.PrinterSettings.PrinterName = "Receipt Printer";

#if DEBUG
            // Preview document
            System.Windows.Forms.PrintPreviewDialog printPreviewDialog1 = new System.Windows.Forms.PrintPreviewDialog();
            printPreviewDialog1.Document = recordDoc;
            printPreviewDialog1.ShowDialog();
#else
            //print with no preview
            recordDoc.Print();
#endif

            //Dispose of document when done printing
            recordDoc.Dispose();
        }
Exemple #4
0
        private void CommandBindingPrintWishlist_Executed(object sender, ExecutedRoutedEventArgs e)
        {
            System.Windows.Forms.PrintPreviewDialog previewDialog = new System.Windows.Forms.PrintPreviewDialog();

            printDocument            = new System.Drawing.Printing.PrintDocument();
            printDocument.PrintPage += new System.Drawing.Printing.PrintPageEventHandler(printDocument_PrintPage);

            previewDialog.Document = printDocument;

            currentPrintRecord = 0;
            currentPage        = 1;

            previewDialog.ShowDialog();
        }
Exemple #5
0
        //-----------------------------------------------------------------------------------
        /// <summary>
        /// Вызывает окно предварительного просмотра печати документа
        /// </summary>
        public void PrintPreview()
        {
            if ((_FileToPrint != null) && (_PrintDocument != null))
            {
                System.Windows.Forms.PrintPreviewDialog printPreviewDialog =
                    new System.Windows.Forms.PrintPreviewDialog();

                // Устанавливаем курсор на начало файла
                System.IO.Stream stream = _FileToPrint.BaseStream;
                stream.Seek(0, System.IO.SeekOrigin.Begin);

                printPreviewDialog.Document = _PrintDocument;
                System.Windows.Forms.DialogResult result = printPreviewDialog.ShowDialog();
            }
            return;
        }
Exemple #6
0
        public virtual void PrintPreview()
        {
            if (_view == null)
            {
                throw new PrintDocumentException("A Diagram reference was not set for this PrintDocument.");
            }

            System.Windows.Forms.PrintPreviewDialog objDialog = new System.Windows.Forms.PrintPreviewDialog();
            objDialog.Document = this;

            //Set the zoom
            _render.Zoom = _view.Zoom;

            objDialog.ShowDialog();
            objDialog.Dispose();
        }
Exemple #7
0
        /// <summary>
        /// 预览
        /// </summary>
        public virtual void Preview()
        {
            PrintDocument doc = new PrintDocument();
            PageSettings  ps  = new PageSettings();

            ps.PaperSize = paperSize;
            ps.Margins   = new Margins(paperInfo.Left, paperInfo.Right, paperInfo.Top, paperInfo.Bottom);

            doc.DefaultPageSettings = ps;

            System.Windows.Forms.PrintPreviewDialog dlg = new System.Windows.Forms.PrintPreviewDialog();
            doc.PrintPage += new PrintPageEventHandler(doc_PrintPage);
            dlg.Document   = doc;

            dlg.ShowDialog();
            doc.Dispose();
        }
Exemple #8
0
        public void PrintLabel(Voodoo.Objects.InventoryItem ItemToPrint)
        {
            itemToPrint = ItemToPrint;

            LabelTemplate labelTemplate = new LabelTemplate();

            if (labelTemplate.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                if (itemToPrint.Quantity > 0 && labelTemplate.SelectedColumnIndex >= 0 && labelTemplate.SelectedRowIndex >= 0)
                {
                    labelRow        = labelTemplate.SelectedRowIndex;
                    labelColumn     = labelTemplate.SelectedColumnIndex;
                    numLabelColumns = labelTemplate.NumberOfColumns;

                    PrintDocument labelDoc;
                    // Create the document and name it
                    labelDoc = new PrintDocument();
                    labelDoc.DocumentName = "Pricing Label";
                    labelDoc.DefaultPageSettings.Landscape = false;

                    labelDoc.PrintPage += new PrintPageEventHandler(this.printTheLabel);

                    PaperSize paperSize = new PaperSize("Label", 850, 1100); //full 8.5 x 11 page
                    //PaperSize paperSize = new PaperSize("Label", 83, 366);
                    labelDoc.DefaultPageSettings.PaperSize = paperSize;

                    Margins margins = new Margins(10, 5, 35, 15);
                    labelDoc.DefaultPageSettings.Margins = margins;
                    labelDoc.PrinterSettings.PrinterName = "HP Deskjet D4200 series";

#if DEBUG
                    // Preview document
                    System.Windows.Forms.PrintPreviewDialog printPreviewDialog1 = new System.Windows.Forms.PrintPreviewDialog();
                    printPreviewDialog1.Document = labelDoc;
                    printPreviewDialog1.ShowDialog();
#else
                    //print with no preview
                    labelDoc.Print();
#endif

                    //Dispose of document when done printing
                    labelDoc.Dispose();
                }
            }
        }
        public virtual void PrintPreview(Point Location, Size Size)
        {
            if (mDiagram == null)
            {
                throw new PrintDocumentException("A Diagram reference was not set for this PrintDocument.");
            }

            System.Windows.Forms.PrintPreviewDialog objDialog = new System.Windows.Forms.PrintPreviewDialog();
            objDialog.Document = this;
            objDialog.Location = Location;
            objDialog.Size     = Size;

            //Set the zoom
            mRender.Zoom = mDiagram.Zoom;

            objDialog.ShowDialog();
            objDialog.Dispose();
        }
Exemple #10
0
 /// <summary>
 /// Handler for the menu item "File" - "Print Preview".
 /// </summary>
 /// <param name="sender">Not used.</param>
 /// <param name="e">Not used.</param>
 private void EhMenuFilePrintPreview_OnClick(object sender, System.EventArgs e)
 {
     try
     {
         System.Windows.Forms.PrintPreviewDialog dlg = new System.Windows.Forms.PrintPreviewDialog();
         Current.PrintingService.PrintDocument.PrintPage += new System.Drawing.Printing.PrintPageEventHandler(this.EhPrintPage);
         dlg.Document = Current.PrintingService.PrintDocument;
         dlg.ShowDialog(this.m_View.Window);
         dlg.Dispose();
     }
     catch (Exception ex)
     {
         System.Windows.Forms.MessageBox.Show(this.m_View.Window, ex.ToString());
     }
     finally
     {
         Current.PrintingService.PrintDocument.PrintPage -= new System.Drawing.Printing.PrintPageEventHandler(this.EhPrintPage);
     }
 }
Exemple #11
0
        private void btnToPrintPreview_Click(object sender, RoutedEventArgs e)
        {
            PrinterInteractiveOverlay printerInteractiveOverlay = (PrinterInteractiveOverlay)Map1.InteractiveOverlays["PrintPreviewOverlay"];
            PagePrinterLayer          pagePrinterLayer          = printerInteractiveOverlay.PrinterLayers["PageLayer"] as PagePrinterLayer;

            PrintDialog   printDialog   = new PrintDialog();
            PrintDocument printDocument = new PrintDocument();

            printDocument.DefaultPageSettings.Landscape = true;
            if (pagePrinterLayer.Orientation == PrinterOrientation.Portrait)
            {
                printDocument.DefaultPageSettings.Landscape = false;
            }

            printDocument.DefaultPageSettings.PaperSize = GetPrintPreviewPaperSize(pagePrinterLayer);

            PrinterGeoCanvas printerGeoCanvas = new PrinterGeoCanvas();

            printerGeoCanvas.DrawingArea = printDocument.DefaultPageSettings.Bounds;
            printerGeoCanvas.BeginDrawing(printDocument, pagePrinterLayer.GetBoundingBox(), Map1.MapUnit);

            // Loop through all of the PrintingLayer in the PrinterInteractiveOverlay and print all of the
            // except for the PagePrinterLayer
            Collection <SimpleCandidate> labelsInAllLayers = new Collection <SimpleCandidate>();

            foreach (PrinterLayer printerLayer in printerInteractiveOverlay.PrinterLayers)
            {
                printerLayer.IsDrawing = true;
                if (!(printerLayer is PagePrinterLayer))
                {
                    printerLayer.Draw(printerGeoCanvas, labelsInAllLayers);
                }
                printerLayer.IsDrawing = false;
            }

            printerGeoCanvas.Flush();

            System.Windows.Forms.PrintPreviewDialog printPreviewDialog = new System.Windows.Forms.PrintPreviewDialog();
            printPreviewDialog.Document = printDocument;
            System.Windows.Forms.DialogResult dialogResult = printPreviewDialog.ShowDialog();
        }
Exemple #12
0
        public void PrintGiftCertificate(string NameOnCertificate, double Amount, int GiftCertificateID, Bitmap barcode)
        {
            PrintDocument labelDoc;

            nameOnCertificate     = NameOnCertificate;
            giftCertificateID     = GiftCertificateID;
            giftCertificateAmount = Amount;
            barcodeToPrint        = barcode;

            // Create the document and name it
            labelDoc = new PrintDocument();
            labelDoc.DocumentName = "Gift Certificate";
            labelDoc.DefaultPageSettings.Landscape = true;

            labelDoc.PrintPage += new PrintPageEventHandler(this.printGiftCertificate);

            PaperSize paperSize = new PaperSize("GiftCertificate", 1100, 850); //full 8.5 x 11 page

            //PaperSize paperSize = new PaperSize("Label", 83, 366);
            labelDoc.DefaultPageSettings.PaperSize = paperSize;

            Margins margins = new Margins(5, 5, 5, 5);

            labelDoc.DefaultPageSettings.Margins = margins;

#if DEBUG
            // Preview document
            System.Windows.Forms.PrintPreviewDialog printPreviewDialog1 = new System.Windows.Forms.PrintPreviewDialog();
            printPreviewDialog1.Document = labelDoc;
            printPreviewDialog1.ShowDialog();
#else
            //print with no preview
            labelDoc.Print();
#endif

            //Dispose of document when done printing
            labelDoc.Dispose();
        }
Exemple #13
0
 /// <summary>
 /// Handler for Print Cards menu item Executed event
 /// </summary>
 /// <param name="sender">not used</param>
 /// <param name="e">not used</param>
 private void PrintCardsCommand_Executed(object sender, ExecutedRoutedEventArgs e)
 {
     CardTabItem cti = mainTabControl.SelectedItem as CardTabItem;
     PrintProperties props = new PrintProperties(
         cti.cardPanel.QslCard.CardPrintProperties);
     if(App.Logger.DebugPrinting)
     {
         App.Logger.Log("PrintCardsCommand_Executed:" +
                        Environment.NewLine +
                        "Card size = " + cti.cardPanel.QslCard.Width +
                        " x " + cti.cardPanel.QslCard.Height +
                        Environment.NewLine +
                        props.ToString());
     }
     HamQSLerPrintDialog printDialog = new HamQSLerPrintDialog();
     printDialog.PrinterName = props.PrinterName;
     printDialog.PrinterPaperSize = props.PrinterPaperSize;
     printDialog.Resolution = props.Resolution;
     printDialog.Source = props.Source;
     printDialog.InsideMargins = props.InsideMargins;
     printDialog.PrintCardOutlines = props.PrintCardOutlines;
     printDialog.FillLastPage = props.FillLastPage;
     printDialog.SetCardMargins = props.SetCardMargins;
     printDialog.Layout = props.Layout;
     printDialog.CardWidth = cti.cardPanel.QslCard.Width;
     printDialog.CardHeight = cti.cardPanel.QslCard.Height;
     if(printDialog.ShowDialog() == true)
     {
         props.PrinterName = printDialog.PrinterName;
         props.PrinterPaperSize = printDialog.PrinterPaperSize;
         props.Resolution = printDialog.Resolution;
         props.Source = printDialog.Source;
         props.InsideMargins = printDialog.InsideMargins;
         props.PrintCardOutlines = printDialog.PrintCardOutlines;
         props.FillLastPage = printDialog.FillLastPage;
         props.SetCardMargins = printDialog.SetCardMargins;
         props.Layout = printDialog.Layout;
         if(App.Logger.DebugPrinting)
         {
             App.Logger.Log("PrintCardsCommand after printDialog.ShowDialog:" +
                            Environment.NewLine +
                            "Card size = " + cti.cardPanel.QslCard.Width +
                            " x " + cti.cardPanel.QslCard.Height +
                            Environment.NewLine +
                            props.ToString());
         }
         CardPrintDocument document =
             new CardPrintDocument(qsosView.DisplayQsos);
         document.PrintProperties = props;
         document.QslCard = cti.cardPanel.QslCard;
         if(printDialog.Preview)
         {
             System.Windows.Forms.PrintPreviewDialog ppDialog =
                 new System.Windows.Forms.PrintPreviewDialog();
             ppDialog.Document = document;
             ppDialog.WindowState = System.Windows.Forms.FormWindowState.Maximized;
             ppDialog.ShowDialog();
         }
         else
         {
             document.Print();
         }
     }
     else
     {
         if(App.Logger.DebugPrinting)
         {
             App.Logger.Log("Printing canceled");
         }
     }
 }
Exemple #14
0
 /// <summary>
 /// Print the GraphicsWindow contents.
 /// 
 /// The window must be visible and a short delay may be required after updating the window before calling.
 /// </summary>
 /// <param name="border">
 /// Include the window border ("True" or "False").
 /// </param>
 /// <returns>
 /// None.
 /// </returns>
 public static void Print(Primitive border)
 {
     GraphicsWindow.Show();
     Utilities.bTextWindow = false;
     Utilities.bBorder = border;
     PrintDocument pd = new PrintDocument();
     pd.PrintPage += new PrintPageEventHandler(Utilities.printWindow);
     System.Windows.Forms.PrintPreviewDialog dlg = new System.Windows.Forms.PrintPreviewDialog();
     dlg.Document = pd;
     dlg.Width = 600;
     dlg.Height = 600;
     dlg.ShowIcon = false;
     dlg.TopMost = true;
     if (LDUtilities.showPreview)
     {
         if (dlg.ShowDialog(Utilities.ForegroundHandle()) == System.Windows.Forms.DialogResult.OK)
         {
             pd.Print();
         }
     }
     else
     {
         pd.Print();
     }
 }
Exemple #15
0
        //-----------------------------------------------------------------------------------
        /// <summary>
        /// Вызывает окно предварительного просмотра печати документа
        /// </summary>
        public void PrintPreview()
        {
            if ((_FileToPrint != null) && (_PrintDocument != null))
            {
                System.Windows.Forms.PrintPreviewDialog printPreviewDialog =
                    new System.Windows.Forms.PrintPreviewDialog();

                // Устанавливаем курсор на начало файла
                System.IO.Stream stream = _FileToPrint.BaseStream;
                stream.Seek(0, System.IO.SeekOrigin.Begin);

                printPreviewDialog.Document = _PrintDocument;
                System.Windows.Forms.DialogResult result = printPreviewDialog.ShowDialog();
            }
            return;
        }
		/// <summary>
		/// Handler for the menu item "File" - "Print Preview".
		/// </summary>
		/// <param name="sender">Not used.</param>
		/// <param name="e">Not used.</param>
		private void EhMenuFilePrintPreview_OnClick(object sender, System.EventArgs e)
		{
			try
			{
				System.Windows.Forms.PrintPreviewDialog dlg = new System.Windows.Forms.PrintPreviewDialog();
				Current.PrintingService.PrintDocument.PrintPage += new System.Drawing.Printing.PrintPageEventHandler(this.EhPrintPage);
				dlg.Document = Current.PrintingService.PrintDocument;
				dlg.ShowDialog(this.m_View.Window);
				dlg.Dispose();
			}
			catch (Exception ex)
			{
				System.Windows.Forms.MessageBox.Show(this.m_View.Window, ex.ToString());
			}
			finally
			{
				Current.PrintingService.PrintDocument.PrintPage -= new System.Drawing.Printing.PrintPageEventHandler(this.EhPrintPage);
			}
		}
        private void PrintCalibratePage()
        {
            var dialog = new System.Windows.Forms.PrintPreviewDialog();

            dialog.Document = new PrintDocument();
            //dialog.Document.PrinterSettings = dialog.PrinterSettings;
            dialog.Document.PrintPage += (s, e) =>
            {
                //Font font1 = new Font("Arial", 11, System.Drawing.FontStyle.Regular);

                //// Construct a new Rectangle .
                //Rectangle displayRectangle =
                //    new Rectangle(40, 40, 180, 180);

                //// Construct 2 new StringFormat objects
                //StringFormat format1 = new StringFormat(StringFormatFlags.NoClip);
                //StringFormat format2 = new StringFormat(format1);

                //// Set the LineAlignment and Alignment properties for
                //// both StringFormat objects to different values.
                //format1.LineAlignment = StringAlignment.Near;
                //format1.Alignment = StringAlignment.Center;

                //format2.LineAlignment = StringAlignment.Center;
                //format2.Alignment = StringAlignment.Far;

                //// Draw the bounding rectangle and a string for each
                //// StringFormat object.
                //e.Graphics.DrawRectangle(Pens.Black, displayRectangle);
                //e.Graphics.DrawString("Showing Format1", font1,
                //    System.Drawing.Brushes.Red, (RectangleF)displayRectangle, format1);
                //e.Graphics.DrawString("Showing Format2", font1,
                //    System.Drawing.Brushes.Red, (RectangleF)displayRectangle, format2);

                //return;
                var x = e.PageSettings.HardMarginX;
                var y = e.PageSettings.HardMarginY;

                double lineHeightCm = 1;
                double lineWidthCm  = 1;

                float lineHeight = (float)CentimeterToPixelConverter.ConvertY(lineHeightCm);
                float lineWidth  = (float)CentimeterToPixelConverter.ConvertX(lineWidthCm);

                float pWidth = e.PageSettings.PaperSize.Width;
                float pHight = e.PageSettings.PaperSize.Height;

                var        pen   = System.Drawing.Pens.Black;
                SolidBrush brush = new SolidBrush(System.Drawing.Color.Black);
                Font       font  = new Font("Arial", 11, System.Drawing.FontStyle.Regular);

                e.Graphics.DrawLine(pen, 200 - x, 500 - y, 200 - x, 600 - y);
                e.Graphics.DrawString("2 дюйма = 5,08 см", font, brush, 220F, 550F);

                e.Graphics.DrawLine(pen, 10F / 2.54F * 100F - x, 10F / 2.54F * 100F - y, 10F / 2.54F * 100F - x, 15F / 2.54F * 100F - y);
                e.Graphics.DrawLine(pen, 10F / 2.54F * 100F - x, 10F / 2.54F * 100F - y, 15F / 2.54F * 100F - x, 10F / 2.54F * 100F - y);
                e.Graphics.DrawString("10 см от верхнего и левого краев", font, brush, 10.5F / 2.54F * 100F, 10.5F / 2.54F * 100F);

                e.Graphics.DrawLine(pen, 15F / 2.54F * 100F - x, 15F / 2.54F * 100F - y, 15F / 2.54F * 100F - x, 17F / 2.54F * 100F - y);
                e.Graphics.DrawLine(pen, 15F / 2.54F * 100F - x, 15F / 2.54F * 100F - y, 17F / 2.54F * 100F - x, 15F / 2.54F * 100F - y);
                e.Graphics.DrawString("15 см от верхнего и левого краев", font, brush, 15.5F / 2.54F * 100F, 15.5F / 2.54F * 100F);

                e.Graphics.DrawLine(pen, 19F / 2.54F * 100F - x, 25F / 2.54F * 100F - y, 19F / 2.54F * 100F - x, 28F / 2.54F * 100F - y);
                e.Graphics.DrawLine(pen, 19F / 2.54F * 100F - x, 25F / 2.54F * 100F - y, 21F / 2.54F * 100F - x, 25F / 2.54F * 100F - y);
                e.Graphics.DrawString("25 от верхнего и\r\n 19 см от левого краев", font, brush, 18F / 2.54F * 100F, 26F / 2.54F * 100F);

                ////1. top-left conner
                //e.Graphics.DrawLine(pen, lineWidth * 0.5F, lineHeight, lineWidth * 1.5F, lineHeight);
                //e.Graphics.DrawLine(pen, lineWidth, lineHeight * 0.5F, lineWidth, lineHeight * 1.5F);
                //e.Graphics.DrawString(string.Format("{0:N1}:{1:N1}", lineWidthCm, lineHeightCm), font, brush, lineWidth * 2F, lineHeight * 2f);

                ////2. top-right conner
                //e.Graphics.DrawLine(pen, e.PageSettings.PaperSize.Width - lineWidth * 1.5F, lineHeight, e.PageSettings.PaperSize.Width - lineWidth * 0.5F, lineHeight);
                //e.Graphics.DrawLine(pen, e.PageSettings.PaperSize.Width - lineWidth, lineHeight * 0.5F, e.PageSettings.PaperSize.Width - lineWidth, lineHeight * 1.5F);
                //e.Graphics.DrawString(string.Format("{0:N1}:{1:N1}", CentimeterToPixelConverter.ConvertToCmX(e.PageSettings.PaperSize.Width - lineWidth), lineHeightCm), font, brush, e.PageSettings.PaperSize.Width - lineWidth * 3F, lineHeight * 2f);

                ////3. bottom-left conner
                //e.Graphics.DrawLine(pen, lineWidth * 0.5F, e.PageSettings.PaperSize.Height - lineHeight, lineHeight * 1.5F, e.PageSettings.PaperSize.Height - lineHeight);
                //e.Graphics.DrawLine(pen, lineWidth, e.PageSettings.PaperSize.Height - lineHeight * 1.5F, lineWidth, e.PageSettings.PaperSize.Height - lineHeight * 0.5F);
                //e.Graphics.DrawString(string.Format("{0:N1}:{1:N1}", lineWidthCm, CentimeterToPixelConverter.ConvertToCmY(e.PageSettings.PaperSize.Height - lineHeight)), font, brush, lineWidth * 2F, e.PageSettings.PaperSize.Height - lineHeight * 2f);

                ////4. bottom-right
                //e.Graphics.DrawLine(pen, e.PageSettings.PaperSize.Width - lineWidth * 1.5F, e.PageSettings.PaperSize.Height - lineHeight, e.PageSettings.PaperSize.Width - lineWidth * 0.5F, e.PageSettings.PaperSize.Height - lineHeight);
                //e.Graphics.DrawLine(pen, e.PageSettings.PaperSize.Width - lineWidth, e.PageSettings.PaperSize.Height - lineHeight * 1.5F, e.PageSettings.PaperSize.Width - lineWidth, e.PageSettings.PaperSize.Height - lineHeight * 0.5F);
                //e.Graphics.DrawString(string.Format("{0:N1}:{1:N1}", CentimeterToPixelConverter.ConvertToCmX(e.PageSettings.PaperSize.Width - lineWidth), CentimeterToPixelConverter.ConvertToCmY(e.PageSettings.PaperSize.Height - lineHeight)), font, brush, e.PageSettings.PaperSize.Width - lineWidth * 3F, e.PageSettings.PaperSize.Height - lineHeight * 2f);

                ////5. Center
                //e.Graphics.DrawLine(pen, e.PageSettings.PaperSize.Width / 2 - lineWidth / 2, e.PageSettings.PaperSize.Height / 2, e.PageSettings.PaperSize.Width / 2 + lineWidth / 2, e.PageSettings.PaperSize.Height / 2);
                //e.Graphics.DrawLine(pen, e.PageSettings.PaperSize.Width / 2, e.PageSettings.PaperSize.Height / 2 - lineHeight / 2, e.PageSettings.PaperSize.Width / 2, e.PageSettings.PaperSize.Height / 2 + lineHeight / 2);
                //e.Graphics.DrawString(string.Format("{0:N1}:{1:N1}", CentimeterToPixelConverter.ConvertToCmX(e.PageSettings.PaperSize.Width / 2), CentimeterToPixelConverter.ConvertToCmY(e.PageSettings.PaperSize.Height / 2)), font, brush, e.PageSettings.PaperSize.Width / 2 + lineWidth, e.PageSettings.PaperSize.Height / 2 + lineHeight);


                //6. Page size
                e.Graphics.DrawString(string.Format("Размер страницы {0:N1}х{1:N1} см.", e.PageSettings.PaperSize.Width / 100F * 2.54,
                                                    e.PageSettings.PaperSize.Height / 100F * 2.54), font, brush, lineWidth * 2F, lineHeight * 5f);

                e.Graphics.DrawString(string.Format("Размер печатной области {0:N1}х{1:N1} см.", e.PageSettings.PrintableArea.Width / 100F * 2.54,
                                                    e.PageSettings.PrintableArea.Height / 100F * 2.54), font, brush, lineWidth * 2F, lineHeight * 6f);


                e.Graphics.DrawString(string.Format("Физический отступ принтера {0:N1}х{1:N1} см.", e.PageSettings.HardMarginX / 100F * 2.54,
                                                    e.PageSettings.HardMarginY / 100F * 2.54), font, brush, lineWidth * 2F, lineHeight * 8f);

                //7. Риски по границам
                //e.Graphics.DrawLine(pen, e.PageSettings.PrintableArea.X, e.PageSettings.PrintableArea.Y, e.PageSettings.PrintableArea.X, e.PageSettings.PrintableArea.Y + lineWidth);
                //e.Graphics.DrawLine(pen, e.PageSettings.PrintableArea.X, e.PageSettings.PrintableArea.Y, e.PageSettings.PrintableArea.X + lineHeight, e.PageSettings.PrintableArea.Y);
                //e.Graphics.DrawLine(pen,e.PageSettings.PrintableArea.Right,e.PageSettings.PrintableArea.Bottom,e.PageSettings.PrintableArea.Right, e.PageSettings.PrintableArea.Bottom - lineHeight);
                //e.Graphics.DrawLine(pen,e.PageSettings.PrintableArea.Right,e.PageSettings.PrintableArea.Bottom,e.PageSettings.PrintableArea.Right - lineWidth, e.PageSettings.PrintableArea.Bottom);
            };

            dialog.ShowDialog();
        }
		public virtual void PrintPreview(Point Location, Size Size)
		{
			if (mDiagram == null) throw new PrintDocumentException("A Diagram reference was not set for this PrintDocument.");

			System.Windows.Forms.PrintPreviewDialog objDialog = new System.Windows.Forms.PrintPreviewDialog();
			objDialog.Document = this;
			objDialog.Location = Location;
			objDialog.Size = Size;

			//Set the zoom
			mRender.Zoom = mDiagram.Zoom;

			objDialog.ShowDialog();
			objDialog.Dispose();
		}
 public void PrintPreview()
 {
     this.CreatePrintDocument();
     using (System.Windows.Forms.PrintPreviewDialog dlg = new System.Windows.Forms.PrintPreviewDialog())
     {
         dlg.Document = this._printDoc;
         dlg.ShowDialog(this.FindForm());
     }
 }