예제 #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
파일: Gutter.cs 프로젝트: stevencohn/Orqa
        private void DrawLineNumber(ITextPainter Painter, int Line, int Left, int Top, bool DrawOnGutter)
        {
            if (this.owner != null)
            {
                Rectangle rectangle1 = new Rectangle(Left, Top, this.lineNumberWidth - (this.lineNumbersLeftIndent + this.lineNumbersRightIndent), this.owner.Painter.FontHeight);
                this.drawInfo.Init();
                this.drawInfo.Line = Line;
                Color color1 = Painter.Color;
                Color color2 = Painter.BkColor;
                bool  flag1  = this.Transparent;
                try
                {
                    string text1;
                    int    num1;
                    int    num3;
                    Painter.Color   = this.lineNumbersForeColor;
                    Painter.BkColor = DrawOnGutter ? this.BrushColor : this.lineNumbersBackColor;
                    if (flag1)
                    {
                        Painter.BkMode = 1;
                    }
                    if (!this.owner.OnCustomDraw(Painter, rectangle1, DrawStage.Before, DrawState.LineNumber | DrawState.Gutter, this.drawInfo))
                    {
                        int num4 = Line + this.lineNumbersStart;
                        text1 = num4.ToString();
                        num1  = flag1 ? 0 : 2;
                        switch (this.lineNumbersAlignment)
                        {
                        case StringAlignment.Near:
                        {
                            Painter.TextOut(text1, -1, rectangle1, num1);
                            goto Label_015A;
                        }

                        case StringAlignment.Center:
                        {
                            goto Label_0129;
                        }

                        case StringAlignment.Far:
                        {
                            int num2 = Painter.StringWidth(text1);
                            Painter.TextOut(text1, -1, rectangle1, (rectangle1.Left + rectangle1.Width) - num2, rectangle1.Top, num1);
                            goto Label_015A;
                        }
                        }
                    }
                    goto Label_015A;
Label_0129:
                    num3 = Painter.StringWidth(text1);
                    Painter.TextOut(text1, -1, rectangle1, rectangle1.Left + ((rectangle1.Width - num3) / 2), rectangle1.Top, num1);
Label_015A:
                    this.owner.OnCustomDraw(Painter, rectangle1, DrawStage.After, DrawState.LineNumber | DrawState.Gutter, this.drawInfo);
                }
                finally
                {
                    if (flag1)
                    {
                        Painter.BkMode = 2;
                    }
                    Painter.Color   = color1;
                    Painter.BkColor = color2;
                }
            }
        }