Exemplo n.º 1
0
        private void nudTopMargin_ValueChanged(object sender, EventArgs e)
        {
            var CHM = new CalcHelper.Math();

            Settings.Default.TopMargin = (int)CHM.MMtoIN(((float)((NumericUpDown)sender).Value));
            Settings.Default.Save();
            SetVerticalMargins();
            pvWydruk.Rows = 1;
            pvWydruk.InvalidatePreview();
        }
Exemplo n.º 2
0
        private void GetPageSettings()
        {
            if (Settings.Default.Landscape)
            {
                rbHorizontal.Checked = true;
            }
            else
            {
                rbVertical.Checked = true;
            }
            var M = new CalcHelper.Math();

            nudLeftMargin.Value = (decimal)Math.Round(M.INtoMM(Settings.Default.LeftMargin));
            nudTopMargin.Value  = (decimal)Math.Round(M.INtoMM(Settings.Default.TopMargin));
        }
Exemplo n.º 3
0
        /// <summary>
        /// Drukuje nagłówek dokumentu na górnym marginesie strony
        /// </summary>
        /// <param name="x">Współrzędna początkowa pozioma</param>
        /// <param name="y">Współrzędna początkowa pionowa</param>
        /// <param name="PrintWidth">Szerokość obszaru wydruku</param>
        public void DrawHeader(float x, float y, float PrintWidth)
        {
            x += Settings.Default.XCaliber;
            y += Settings.Default.YCaliber;
            var DotPen     = new Pen(Color.Black);
            var M          = new CalcHelper.Math();
            var HeaderFont = new Font("Arial", 8, FontStyle.Italic, GraphicsUnit.Point);

            y -= M.MMtoIN(5);
            G.DrawLine(DotPen, x, y, x + PrintWidth, y);
            y -= HeaderFont.GetHeight(G);
            var strFormat = new StringFormat();

            strFormat.LineAlignment = StringAlignment.Center;
            strFormat.Alignment     = StringAlignment.Near;
            G.DrawString(Settings.Default.SchoolName, HeaderFont, Brushes.Black, new Rectangle((int)x, (int)y, (int)PrintWidth, (int)HeaderFont.GetHeight(G)), strFormat);
            strFormat.Alignment = StringAlignment.Far;
            G.DrawString("Rok szkolny: " + Settings.Default.SchoolYear, HeaderFont, Brushes.Black, new Rectangle((int)x, (int)y, (int)PrintWidth, (int)HeaderFont.GetHeight(G)), strFormat);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Drukuje stopkę dokumentu na dolnym marginesie strony
        /// </summary>
        /// <param name="x">Współrzędna początkowa pozioma</param>
        /// <param name="y">Współrzędna początkowa pionowa</param>
        /// <param name="PrintWidth">Szerokość obszaru wydruku</param>
        public void DrawFooter(float x, float y, float PrintWidth)
        {
            x += Settings.Default.XCaliber;
            y += Settings.Default.YCaliber;
            var DotPen     = new Pen(Color.Black);
            var M          = new CalcHelper.Math();
            var FooterFont = new Font("Arial", 8, FontStyle.Italic, GraphicsUnit.Point);

            y += M.MMtoIN(5);
            G.DrawLine(DotPen, x, y, x + PrintWidth, y);
            y += FooterFont.GetHeight(G) / 2;
            var strFormat = new StringFormat();

            strFormat.LineAlignment = StringAlignment.Center;
            strFormat.Alignment     = StringAlignment.Near;
            G.DrawString(System.Windows.Forms.Application.ProductName + " (wersja " + System.Windows.Forms.Application.ProductVersion + ")", FooterFont, Brushes.Black, new Rectangle((int)x, (int)y, (int)PrintWidth, (int)FooterFont.GetHeight(G)), strFormat);
            strFormat.Alignment = StringAlignment.Far;
            G.DrawString(DateTime.Now.ToString(), FooterFont, Brushes.Black, new Rectangle((int)x, (int)y, (int)PrintWidth, (int)FooterFont.GetHeight(G)), strFormat);
        }
Exemplo n.º 5
0
        /// <summary>
        /// Drukuje nr strony na górnym lub dolnym marginesie
        /// </summary>
        /// <param name="PageNumber">Nr strony</param>
        /// <param name="x">współrzędna x</param>
        /// <param name="y">współrzędna y</param>
        /// <param name="PrintWidth">Szerokość obszaru wydruku</param>
        /// <param name="Location">Lokalizacja nr strony (górny lub dolny margines)</param>
        /// <param name="HorizontalAlignment">Poziome położenie nr strony</param>
        public void DrawPageNumber(string PageNumber, float x, float y, float PrintWidth, CustomType.PageNumberLocation Location, byte HorizontalAlignment = 1)
        {
            x += Settings.Default.XCaliber;
            y += Settings.Default.YCaliber;
            var M        = new CalcHelper.Math();
            var BaseFont = new Font("Arial", 8, FontStyle.Regular, GraphicsUnit.Point);

            if (Location == CustomType.PageNumberLocation.Header)
            {
                y -= M.MMtoIN(5) + BaseFont.GetHeight(G);
            }
            else
            {
                y += M.MMtoIN(5) + BaseFont.GetHeight(G);
            }
            var strFormat = new StringFormat();

            strFormat.LineAlignment = StringAlignment.Center;
            strFormat.Alignment     = (StringAlignment)HorizontalAlignment;
            G.DrawString(PageNumber, BaseFont, Brushes.Black, new Rectangle((int)x, (int)y, (int)PrintWidth, (int)BaseFont.GetHeight(G)), strFormat);
        }