예제 #1
0
        public void Paint(ITextPainter Painter, Rectangle Rect, int PageIndex, int PageCount, bool PageNumbers)
        {
            System.Drawing.Font font1 = Painter.Font;
            Color color1 = Painter.Color;

            Painter.BkMode = 1;
            try
            {
                DrawInfo info1;
                Painter.Font  = this.Font;
                Painter.Color = this.fontColor;
                EditPages pages1 = this.GetPages();
                info1 = new DrawInfo();
                info1.Init();
                info1.Page = (this.page != null) ? this.page.Index : -1;
                SyntaxEdit edit1 = ((pages1 != null) && (pages1.Owner != null)) ? ((SyntaxEdit)pages1.Owner) : null;
                if ((edit1 == null) || !edit1.OnCustomDraw(Painter, Rect, DrawStage.Before, DrawState.PageHeader, info1))
                {
                    bool   flag1 = ((pages1 != null) && this.reverseOnEvenPages) && (((PageIndex + 1) % 2) == 0);
                    string text2 = PageNumbers ? ((PageIndex + 1)).ToString() : this.RightText;
                    string text1 = flag1 ? text2 : this.LeftText;
                    if ((text1 != null) && (text1 != string.Empty))
                    {
                        Painter.TextOut(this.GetTextToPaint(text1, PageIndex, PageCount), -1, Rect);
                    }
                    text1 = this.CenterText;
                    if ((text1 != null) && (text1 != string.Empty))
                    {
                        text1 = this.GetTextToPaint(text1, PageIndex, PageCount);
                        int num1 = Painter.StringWidth(text1);
                        Painter.TextOut(text1, -1, (int)(((Rect.Left + Rect.Right) - num1) >> 1), Rect.Top);
                    }
                    text1 = flag1 ? this.LeftText : text2;
                    if ((text1 != null) && (text1 != string.Empty))
                    {
                        text1 = this.GetTextToPaint(text1, PageIndex, PageCount);
                        int num2 = Painter.StringWidth(text1);
                        Painter.TextOut(text1, -1, (int)(Rect.Right - num2), Rect.Top);
                    }
                }
                if (edit1 != null)
                {
                    edit1.OnCustomDraw(Painter, Rect, DrawStage.After, DrawState.PageHeader, info1);
                }
            }
            finally
            {
                Painter.BkMode = 2;
                Painter.Font   = font1;
                Painter.Color  = color1;
            }
        }
예제 #2
0
 public void Paint(ITextPainter Painter)
 {
     if ((this.pages != null) && (this.pages.PageType != PageType.Normal))
     {
         DrawInfo   info1;
         SyntaxEdit edit1      = (SyntaxEdit)this.pages.Owner;
         Rectangle  rectangle1 = this.ClientRect;
         info1 = new DrawInfo();
         if (this.pages.PageType == PageType.PageBreaks)
         {
             Rectangle rectangle2 = edit1.ClientRect;
             rectangle1.X     = rectangle2.Left + ((Gutter)edit1.Gutter).GetWidth();
             rectangle1.Width = rectangle2.Right - rectangle1.Left;
             if (!this.IsLastPage)
             {
                 info1.Init();
                 info1.Page = this.Index;
                 if (edit1.OnCustomDraw(Painter, rectangle1, DrawStage.Before, DrawState.PageBorder, info1))
                 {
                     return;
                 }
                 Painter.DrawLine(rectangle1.Left, rectangle1.Bottom - 1, rectangle1.Right, rectangle1.Bottom - 1, this.pages.BorderColor, 1, DashStyle.Dot);
                 edit1.OnCustomDraw(Painter, rectangle1, DrawStage.After, DrawState.PageBorder, info1);
             }
         }
         else
         {
             Rectangle rectangle3 = this.BoundsRect;
             info1.Init();
             info1.Page = this.Index;
             if (!edit1.OnCustomDraw(Painter, rectangle3, DrawStage.Before, DrawState.PageBorder, info1))
             {
                 bool flag1 = this.pages.DisplayWhiteSpace;
                 int  num1  = edit1.Painter.FontHeight;
                 if (num1 != 0)
                 {
                     rectangle1.Height = (rectangle1.Height / num1) * num1;
                 }
                 Rectangle rectangle4 = this.PaintRect;
                 rectangle3.Inflate(1, 1);
                 this.FrameRect(Painter, ref rectangle3, this.pages.BorderColor, this.pages.BackColor, flag1);
                 this.FillBoundsRect(Painter, rectangle4, rectangle3, this.pages.BackColor, false);
                 rectangle3 = this.BoundsRect;
                 this.FillBoundsRect(Painter, rectangle3, rectangle1, edit1.BackColor, this.pages.Transparent);
                 if ((this.pages == null) || this.pages.DisplayWhiteSpace)
                 {
                     int       num2       = Math.Max((int)(rectangle1.Left - this.header.Offset.X), rectangle3.Left);
                     int       num3       = Math.Min((int)((rectangle1.Left + rectangle1.Width) + this.header.Offset.X), rectangle3.Right);
                     Rectangle rectangle5 = new Rectangle(num2, Math.Max((int)(rectangle1.Top - (this.header.Offset.Y + this.header.Font.Height)), this.BoundsRect.Top), num3 - num2, this.header.Font.Height);
                     this.header.Paint(Painter, rectangle5, this.Index, this.pages.Count, false);
                     num2       = Math.Max((int)(rectangle1.Left - this.footer.Offset.X), rectangle3.Left);
                     num3       = Math.Min((int)((rectangle1.Left + rectangle1.Width) + this.footer.Offset.X), rectangle3.Right);
                     rectangle5 = new Rectangle(num2, Math.Min((int)(rectangle1.Bottom + this.footer.Offset.Y), (int)(rectangle3.Bottom - this.footer.Font.Height)), num3 - num2, this.footer.Font.Height);
                     this.footer.Paint(Painter, rectangle5, this.Index, this.pages.Count, this.paintNumber);
                 }
                 edit1.OnCustomDraw(Painter, rectangle3, DrawStage.After, DrawState.PageBorder, info1);
             }
             edit1.PaintWindow(Painter, this.startLine, new Rectangle(0, 0, rectangle1.Width, rectangle1.Height), rectangle1.Location, 1f, 1f, true);
         }
     }
 }