public void Paint(Graphics g, Rectangle rect)
        {
            if (rect.Width <= 0 || rect.Height <= 0)
            {
                return;
            }

            HighlightColor lineNumberPainterColor = Shared.TEP.LineNumbersColor;
            int            fontHeight             = TextArea.TextView.FontHeight;
            Brush          fillBrush = TextArea.Enabled ? BrushRegistry.GetBrush(lineNumberPainterColor.BackgroundColor) : SystemBrushes.InactiveBorder;
            Brush          drawBrush = BrushRegistry.GetBrush(lineNumberPainterColor.Color);

            for (int y = 0; y < (DrawingPosition.Height + TextArea.TextView.VisibleLineDrawingRemainder) / fontHeight + 1; ++y)
            {
                int       ypos = DrawingPosition.Y + fontHeight * y - TextArea.TextView.VisibleLineDrawingRemainder;
                Rectangle backgroundRectangle = new Rectangle(DrawingPosition.X, ypos, DrawingPosition.Width, fontHeight);
                if (rect.IntersectsWith(backgroundRectangle))
                {
                    g.FillRectangle(fillBrush, backgroundRectangle);
                    int curLine = TextArea.Document.GetFirstLogicalLine(TextArea.Document.GetVisibleLine(TextArea.TextView.FirstVisibleLine) + y);

                    if (curLine < TextArea.Document.TotalNumberOfLines)
                    {
                        g.DrawString((curLine + 1).ToString(),
                                     FontRegistry.GetFont(lineNumberPainterColor.Bold, lineNumberPainterColor.Italic),
                                     drawBrush,
                                     backgroundRectangle,
                                     _numberStringFormat);
                    }
                }
            }
        }
Пример #2
0
 public virtual Font GetFont()
 {
     return(FontRegistry.GetFont(SyntaxColor.Bold, SyntaxColor.Italic));
 }