Example #1
0
        /// <summary>
        /// Default constructor
        /// </summary>
        public PageSettings() {
            m_oHeader = DefaultHeader;
            m_oFooter = DefaultFooter;

            // Set default margins to 1/2 inch (50/100ths)
            base.Margins.Top = 50;
            base.Margins.Left = 50;
            base.Margins.Right = 50;
            base.Margins.Bottom = 50;
        }
Example #2
0
        /// <summary>
        /// Default constructor
        /// </summary>
        public PageSettings()
        {
            m_oHeader = DefaultHeader;
            m_oFooter = DefaultFooter;

            // Set default margins to 1/2 inch (50/100ths)
            base.Margins.Top    = 50;
            base.Margins.Left   = 50;
            base.Margins.Right  = 50;
            base.Margins.Bottom = 50;
        }
        /// <summary>
        /// Default constructor
        /// </summary>
        public PageSettings() {
            m_oHeader = DefaultHeader;
            m_oFooter = DefaultFooter;
            m_sFontMagification = 0;
            m_eColorMode = PrintOption.Normal;

            // Set default margins to 1/2 inch (50/100ths)
            base.Margins.Top = 50;
            base.Margins.Left = 50;
            base.Margins.Right = 50;
            base.Margins.Bottom = 50;
        }
Example #4
0
        /// <summary>
        /// Default constructor
        /// </summary>
        public PageSettings()
        {
            m_oHeader           = DefaultHeader;
            m_oFooter           = DefaultFooter;
            m_sFontMagification = 0;
            m_eColorMode        = PrintOption.Normal;

            // Set default margins to 1/2 inch (50/100ths)
            base.Margins.Top    = 50;
            base.Margins.Left   = 50;
            base.Margins.Right  = 50;
            base.Margins.Bottom = 50;
        }
Example #5
0
        private Rectangle DrawHeader(Graphics oGraphics, Rectangle oBounds, PageInformation oHeader) {
            if (oHeader.Display) {
                Rectangle oHeaderBounds = new Rectangle(oBounds.Left, oBounds.Top, oBounds.Width, oHeader.Height);

                oHeader.Draw(oGraphics, oHeaderBounds, this.DocumentName, m_iCurrentPrintPage);

                return new Rectangle(
                    oBounds.Left, oBounds.Top + oHeaderBounds.Height + oHeader.Margin,
                    oBounds.Width, oBounds.Height - oHeaderBounds.Height - oHeader.Margin
                    );
            }
            else {
                return oBounds;
            }
        }
Example #6
0
        private Rectangle DrawHeader(Graphics oGraphics, Rectangle oBounds, PageInformation oHeader)
        {
            if (oHeader.Display)
            {
                Rectangle oHeaderBounds = new Rectangle(oBounds.Left, oBounds.Top, oBounds.Width, oHeader.Height);

                oHeader.Draw(oGraphics, oHeaderBounds, this.DocumentName, m_iCurrentPrintPage);

                return(new Rectangle(
                           oBounds.Left, oBounds.Top + oHeaderBounds.Height + oHeader.Margin,
                           oBounds.Width, oBounds.Height - oHeaderBounds.Height - oHeader.Margin
                           ));
            }
            else
            {
                return(oBounds);
            }
        }
Example #7
0
        private Rectangle DrawFooter(Graphics oGraphics, Rectangle oBounds, PageInformation oFooter)
        {
            if (oFooter.Display)
            {
                int       iHeight       = oFooter.Height;
                Rectangle oFooterBounds = new Rectangle(oBounds.Left, oBounds.Bottom - iHeight, oBounds.Width, iHeight);

                oFooter.Draw(oGraphics, oFooterBounds, this.DocumentName, m_iCurrentPrintPage);

                return(new Rectangle(
                           oBounds.Left, oBounds.Top,
                           oBounds.Width, oBounds.Height - oFooterBounds.Height - oFooter.Margin
                           ));
            }
            else
            {
                return(oBounds);
            }
        }
Example #8
0
        /// <summary>
        /// Method called when printing a page
        /// </summary>
        /// <param name="e">A PrintPageEventArgs that contains the event data</param>
        protected override void OnPrintPage(PrintPageEventArgs e)
        {
            base.OnPrintPage(e);

            PageSettings    oPageSettings = null;
            PageInformation oHeader       = PageSettings.DefaultHeader;
            PageInformation oFooter       = PageSettings.DefaultFooter;
            Rectangle       oPrintBounds  = e.MarginBounds;
            bool            bIsPreview    = this.PrintController.IsPreview;

            // When not in preview mode, adjust graphics to account for hard margin of the printer
            if (!bIsPreview)
            {
                e.Graphics.TranslateTransform(-e.PageSettings.HardMarginX, -e.PageSettings.HardMarginY);
            }

            // Get the header and footer provided if using Scintilla.Printing.PageSettings
            if (e.PageSettings is PageSettings)
            {
                oPageSettings = (PageSettings)e.PageSettings;

                oHeader = oPageSettings.Header;
                oFooter = oPageSettings.Footer;

                m_oScintillaControl.PrintMagnification = oPageSettings.FontMagification;
                m_oScintillaControl.PrintColorMode     = (int)oPageSettings.ColorMode;
            }

            // Draw the header and footer and get remainder of page bounds
            oPrintBounds = DrawHeader(e.Graphics, oPrintBounds, oHeader);
            oPrintBounds = DrawFooter(e.Graphics, oPrintBounds, oFooter);

            // When not in preview mode, adjust page bounds to account for hard margin of the printer
            if (!bIsPreview)
            {
                oPrintBounds.Offset((int)-e.PageSettings.HardMarginX, (int)-e.PageSettings.HardMarginY);
            }
            DrawCurrentPage(e.Graphics, oPrintBounds);

            // Increment the page count and determine if there are more pages to be printed
            m_iCurrentPage++;
            e.HasMorePages = (m_iPosition < m_iPrintEnd);
        }
Example #9
0
        protected override void OnPrintPage(PrintPageEventArgs e)
        {
            base.OnPrintPage(e);

            PageInformation oHeader      = PageSettings.DefaultHeader;
            PageInformation oFooter      = PageSettings.DefaultFooter;
            Rectangle       oPrintBounds = e.MarginBounds;
            bool            bIsPreview   = this.PrintController.IsPreview;

            // When not in preview mode, adjust graphics to account for hard margin of the printer
            if (!bIsPreview)
            {
                e.Graphics.TranslateTransform(-e.PageSettings.HardMarginX, -e.PageSettings.HardMarginY);
            }

            // Draw border for test purposes
            e.Graphics.DrawRectangle(Pens.LightBlue, e.MarginBounds);

            // Get the header and footer provided if using Scintilla.Printing.PageSettings
            if (e.PageSettings is PageSettings)
            {
                oHeader = (e.PageSettings as PageSettings).Header;
                oFooter = (e.PageSettings as PageSettings).Footer;
            }

            // Draw the header and footer and get remainder of page bounds
            oPrintBounds = DrawHeader(e.Graphics, oPrintBounds, oHeader);
            oPrintBounds = DrawFooter(e.Graphics, oPrintBounds, oFooter);

            // When not in preview mode, adjust page bounds to account for hard margin of the printer
            if (!bIsPreview)
            {
                oPrintBounds.Offset((int)-e.PageSettings.HardMarginX, (int)-e.PageSettings.HardMarginY);
            }
            DrawCurrentPage(e.Graphics, oPrintBounds);

            // Increment the page count and determine if there are more pages to be printed
            m_iCurrentPrintPage++;
            e.HasMorePages = (m_iLastPrintPosition < m_iTextLength);
        }
Example #10
0
        private Rectangle DrawFooter(Graphics oGraphics, Rectangle oBounds, PageInformation oFooter) {
            if (oFooter.Display) {
                int iHeight = oFooter.Height;
                Rectangle oFooterBounds = new Rectangle(oBounds.Left, oBounds.Bottom - iHeight, oBounds.Width, iHeight);

                oFooter.Draw(oGraphics, oFooterBounds, this.DocumentName, m_iCurrentPrintPage);

                return new Rectangle(
                    oBounds.Left, oBounds.Top,
                    oBounds.Width, oBounds.Height - oFooterBounds.Height - oFooter.Margin
                    );
            }
            else {
                return oBounds;
            }
        }