示例#1
0
 private static void OnPagePainted(StiPage sender, StiPagePaintEventArgs e)
 {
     if (copyrightPosition == Position.Front)
     {
         var page = sender as StiPage;
         DrawCopyright(page, e);
     }
 }
 private static void OnPagePainting(StiPage sender, StiPagePaintEventArgs e)
 {
     if (copyrightPosition == Position.Behind)
     {
         StiPage page = sender as StiPage;
         DrawCopyright(page, e);
     }
 }
示例#3
0
        private static void DrawCopyright(StiPage page, StiPagePaintEventArgs e)
        {
            if (e.IsPrinting && (!printer))
            {
                return;
            }
            if (e.IsDesigning && (!designer))
            {
                return;
            }
            if ((!e.IsDesigning) && (!e.IsPrinting) && (!preview))
            {
                return;
            }

            var rect = e.FullRectangle;

            if (rectClient)
            {
                rect = e.ClientRectangle;
            }

            using (Font font = new Font("Arial", 20 * (float)page.Zoom))
                using (StringFormat sf = new StringFormat())
                {
                    switch (copyrightPlace)
                    {
                    case Place.TopLeft:
                        sf.Alignment     = StringAlignment.Near;
                        sf.LineAlignment = StringAlignment.Near;
                        break;

                    case Place.TopRight:
                        sf.Alignment     = StringAlignment.Far;
                        sf.LineAlignment = StringAlignment.Near;
                        break;

                    case Place.Center:
                        sf.Alignment     = StringAlignment.Center;
                        sf.LineAlignment = StringAlignment.Center;
                        break;

                    case Place.BottomLeft:
                        sf.Alignment     = StringAlignment.Near;
                        sf.LineAlignment = StringAlignment.Far;
                        break;

                    case Place.BottomRight:
                        sf.Alignment     = StringAlignment.Far;
                        sf.LineAlignment = StringAlignment.Far;
                        break;
                    }

                    e.Graphics.DrawString(copyrightString, font, Brushes.Red, rect, sf);
                }
        }