Esempio n. 1
0
        public ScintillaPageSettings()
        {
            baseColor = base.Color;

            _header            = new HeaderInformation(PageInformationBorder.Bottom, InformationType.DocumentName, InformationType.Nothing, InformationType.PageNumber);
            _footer            = new FooterInformation(PageInformationBorder.Top, InformationType.Nothing, InformationType.Nothing, InformationType.Nothing);
            _fontMagnification = 0;
            _colorMode         = PrintColorMode.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;
        }
Esempio n. 2
0
        protected override void OnPrintPage(PrintPageEventArgs e)
        {
            base.OnPrintPage(e);

            ScintillaPageSettings oPageSettings = null;
            HeaderInformation     oHeader       = ((ScintillaPageSettings)DefaultPageSettings).Header;
            FooterInformation     oFooter       = ((ScintillaPageSettings)DefaultPageSettings).Footer;
            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 ScintillaPageSettings)
            {
                oPageSettings = (ScintillaPageSettings)e.PageSettings;

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

                sci.SetPrintMagnification(oPageSettings.FontMagnification);
                sci.SetPrintColourMode((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
            _iCurrentPage++;
            e.HasMorePages = (_iPosition < _iPrintEnd);
        }