GetPen() 공개 정적인 메소드

public static GetPen ( Color color ) : Pen
color Color
리턴 System.Drawing.Pen
예제 #1
0
        void DrawFoldMarker(Graphics g, RectangleF rectangle, bool isOpened, bool isSelected)
        {
            HighlightColor foldMarkerColor  = Shared.TEP.FoldMarkerColor;
            HighlightColor foldLineColor    = Shared.TEP.FoldLineColor;
            HighlightColor selectedFoldLine = Shared.TEP.SelectedFoldLineColor;

            Rectangle intRect = new Rectangle((int)rectangle.X, (int)rectangle.Y, (int)rectangle.Width, (int)rectangle.Height);

            g.FillRectangle(BrushRegistry.GetBrush(foldMarkerColor.BackgroundColor), intRect);
            g.DrawRectangle(BrushRegistry.GetPen(isSelected ? selectedFoldLine.Color : foldLineColor.Color), intRect);

            int space = (int)Math.Round(((double)rectangle.Height) / 8d) + 1;
            int mid   = intRect.Height / 2 + intRect.Height % 2;

            // draw minus
            g.DrawLine(BrushRegistry.GetPen(foldMarkerColor.Color),
                       rectangle.X + space,
                       rectangle.Y + mid,
                       rectangle.X + rectangle.Width - space,
                       rectangle.Y + mid);

            // draw plus
            if (!isOpened)
            {
                g.DrawLine(BrushRegistry.GetPen(foldMarkerColor.Color),
                           rectangle.X + mid,
                           rectangle.Y + space,
                           rectangle.X + mid,
                           rectangle.Y + rectangle.Height - space);
            }
        }
예제 #2
0
        float PaintFoldingText(Graphics g, int lineNumber, float physicalXPos, Rectangle lineRectangle, string text, bool drawSelected)
        {
            // TODO: get font and color from the highlighting file
            HighlightColor selectionColor  = textArea.Document.HighlightingStrategy.GetColorFor("Selection");
            Brush          bgColorBrush    = drawSelected ? BrushRegistry.GetBrush(selectionColor.BackgroundColor) : GetBgColorBrush(lineNumber);
            Brush          backgroundBrush = textArea.Enabled ? bgColorBrush : SystemBrushes.InactiveBorder;

            float      wordWidth = g.MeasureString(text, textArea.Font, Int32.MaxValue, measureStringFormat).Width;
            RectangleF rect      = new RectangleF(physicalXPos, lineRectangle.Y, wordWidth, lineRectangle.Height - 1);

            g.FillRectangle(backgroundBrush, rect);

            physicalColumn += text.Length;
            g.DrawString(text,
                         textArea.Font,
                         BrushRegistry.GetBrush(drawSelected ? selectionColor.Color : Color.Gray),
                         rect,
                         measureStringFormat);
            g.DrawRectangle(BrushRegistry.GetPen(drawSelected ? Color.DarkGray : Color.Gray), rect.X, rect.Y, rect.Width, rect.Height);

            // Bugfix for the problem - of overdrawn right rectangle lines.
            float ceiling = (float)Math.Ceiling(physicalXPos + wordWidth);

            if (ceiling - (physicalXPos + wordWidth) < 0.5)
            {
                ++ceiling;
            }
            return(ceiling);
        }
예제 #3
0
        protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
        {
            Graphics       g          = e.Graphics;
            int            num        = textArea.VirtualTop.X;  //スクロール位置から開始番号を決定する
            HighlightColor color      = textArea.Document.HighlightingStrategy.GetColorFor("Default");
            Font           editorFont = color.GetFont(textArea.Document.TextEditorProperties.FontContainer);
            Font           font       = new Font(editorFont.FontFamily, editorFont.Size * 0.75F);

            for (float x = textArea.TextView.DrawingPosition.Left; x < textArea.TextView.DrawingPosition.Right; x += textArea.TextView.WideSpaceWidth)
            {
                int offset = Height - (int)((double)Height / (double)3);
                if (num % 5 == 0)
                {
                    offset = Height - Height / 2;
                }

                if (num % 10 == 0)
                {
                    //10桁ごとに位置番号を表示する
                    offset = 2;
                    g.DrawString(num.ToString(), font
                                 , BrushRegistry.GetBrush(color.Color), (float)x, (float)1);
                }

                //縦線描画
                ++num;
                g.DrawLine(BrushRegistry.GetPen(color.Color),
                           (int)x, offset, (int)x, Height - 1);
            }

            //下線表示
            g.DrawLine(BrushRegistry.GetPen(color.Color), textArea.TextView.DrawingPosition.Left, Height - 1
                       , textArea.TextView.DrawingPosition.Right, Height - 1);
        }
예제 #4
0
        void DrawMarker(Graphics g, TextMarker marker, RectangleF drawingRect)
        {
            float drawYPos = drawingRect.Bottom - 1;

            switch (marker.TextMarkerType)
            {
            case TextMarkerType.Underlined:
                g.DrawLine(BrushRegistry.GetPen(marker.Color), drawingRect.X, drawYPos, drawingRect.Right, drawYPos);
                break;

            case TextMarkerType.WaveLine:
//					Console.WriteLine("Drawing wave in {0}", drawingRect);
                int reminder = ((int)drawingRect.X) % 6;
                for (float i = drawingRect.X - reminder; i < drawingRect.Right + reminder; i += 6)
                {
                    g.DrawLine(BrushRegistry.GetPen(marker.Color), i, drawYPos + 3 - 4, i + 3, drawYPos + 1 - 4);
                    g.DrawLine(BrushRegistry.GetPen(marker.Color), i + 3, drawYPos + 1 - 4, i + 6, drawYPos + 3 - 4);
                }
                break;

            case TextMarkerType.SolidBlock:
                g.FillRectangle(BrushRegistry.GetBrush(marker.Color), drawingRect);
                break;
            }
        }
예제 #5
0
        void DrawFoldMarker(Graphics g, RectangleF rectangle, bool isOpened, bool isSelected)
        {
            HighlightColor foldMarkerColor  = textArea.Document.HighlightingStrategy.GetColorFor("FoldMarker");
            HighlightColor foldLineColor    = textArea.Document.HighlightingStrategy.GetColorFor("FoldLine");
            HighlightColor selectedFoldLine = textArea.Document.HighlightingStrategy.GetColorFor("SelectedFoldLine");

            Rectangle intRect = new Rectangle((int)rectangle.X, (int)rectangle.Y, (int)rectangle.Width, (int)rectangle.Height);

            g.FillRectangle(BrushRegistry.GetBrush(foldMarkerColor.BackgroundColor), intRect);
            g.DrawRectangle(BrushRegistry.GetPen(isSelected ? selectedFoldLine.Color : foldMarkerColor.Color), intRect);

            int space = (int)Math.Round(((double)rectangle.Height) / 8d) + 1;
            int mid   = intRect.Height / 2 + intRect.Height % 2;

            g.DrawLine(BrushRegistry.GetPen(foldLineColor.BackgroundColor),
                       rectangle.X + space,
                       rectangle.Y + mid,
                       rectangle.X + rectangle.Width - space,
                       rectangle.Y + mid);

            if (!isOpened)
            {
                g.DrawLine(BrushRegistry.GetPen(foldLineColor.BackgroundColor),
                           rectangle.X + mid,
                           rectangle.Y + space,
                           rectangle.X + mid,
                           rectangle.Y + rectangle.Height - space);
            }
        }
예제 #6
0
        private void DrawVerticalRuler(Graphics g, Rectangle lineRectangle)
        {
            int wideSpaceWidth = this.WideSpaceWidth * base.TextEditorProperties.VerticalRulerRow - this.textArea.VirtualTop.X;

            if (wideSpaceWidth <= 0)
            {
                return;
            }
            HighlightColor colorFor = this.textArea.Document.HighlightingStrategy.GetColorFor("VRuler");

            g.DrawLine(BrushRegistry.GetPen(colorFor.Color), this.drawingPosition.Left + wideSpaceWidth, lineRectangle.Top, this.drawingPosition.Left + wideSpaceWidth, lineRectangle.Bottom);
        }
예제 #7
0
        private int PaintFoldingText(Graphics g, int lineNumber, int physicalXPos, Rectangle lineRectangle, string text, bool drawSelected)
        {
            HighlightColor colorFor    = this.textArea.Document.HighlightingStrategy.GetColorFor("Selection");
            Brush          brush       = (drawSelected ? BrushRegistry.GetBrush(colorFor.BackgroundColor) : this.GetBgColorBrush(lineNumber));
            Brush          brush1      = (this.textArea.Enabled ? brush : SystemBrushes.InactiveBorder);
            Font           regularFont = this.textArea.TextEditorProperties.FontContainer.RegularFont;
            int            num         = this.MeasureStringWidth(g, text, regularFont) + 1;
            Rectangle      rectangle   = new Rectangle(physicalXPos, lineRectangle.Y, num, lineRectangle.Height - 1);

            g.FillRectangle(brush1, rectangle);
            this.physicalColumn += text.Length;
            this.DrawString(g, text, regularFont, (drawSelected ? colorFor.Color : Color.Gray), rectangle.X + 1, rectangle.Y);
            g.DrawRectangle(BrushRegistry.GetPen((drawSelected ? Color.DarkGray : Color.Gray)), rectangle.X, rectangle.Y, rectangle.Width, rectangle.Height);
            return(physicalXPos + num + 1);
        }
예제 #8
0
        void DrawVerticalRuler(Graphics g, Rectangle lineRectangle)
        {
            if (TextEditorProperties.VerticalRulerRow < textArea.VirtualTop.X)
            {
                return;
            }
            HighlightColor vRulerColor = textArea.Document.HighlightingStrategy.GetColorFor("VRuler");

            int xpos = (int)(drawingPosition.Left + GetWidth(g, ' ') * (TextEditorProperties.VerticalRulerRow - textArea.VirtualTop.X));

            g.DrawLine(BrushRegistry.GetPen(vRulerColor.Color),
                       xpos,
                       lineRectangle.Top,
                       xpos,
                       lineRectangle.Bottom);
        }
        private void DrawFoldMarker(Graphics g, RectangleF rectangle, bool isOpened, bool isSelected)
        {
            HighlightColor colorFor       = this.textArea.Document.HighlightingStrategy.GetColorFor("FoldMarker");
            HighlightColor highlightColor = this.textArea.Document.HighlightingStrategy.GetColorFor("FoldLine");
            HighlightColor colorFor1      = this.textArea.Document.HighlightingStrategy.GetColorFor("SelectedFoldLine");
            Rectangle      rectangle1     = new Rectangle((int)rectangle.X, (int)rectangle.Y, (int)rectangle.Width, (int)rectangle.Height);

            g.FillRectangle(BrushRegistry.GetBrush(colorFor.BackgroundColor), rectangle1);
            g.DrawRectangle(BrushRegistry.GetPen((isSelected ? colorFor1.Color : highlightColor.Color)), rectangle1);
            int num    = (int)Math.Round((double)rectangle.Height / 8) + 1;
            int height = rectangle1.Height / 2 + rectangle1.Height % 2;

            g.DrawLine(BrushRegistry.GetPen(colorFor.Color), rectangle.X + (float)num, rectangle.Y + (float)height, rectangle.X + rectangle.Width - (float)num, rectangle.Y + (float)height);
            if (!isOpened)
            {
                g.DrawLine(BrushRegistry.GetPen(colorFor.Color), rectangle.X + (float)height, rectangle.Y + (float)num, rectangle.X + (float)height, rectangle.Y + rectangle.Height - (float)num);
            }
        }
예제 #10
0
        private void DrawMarkerDraw(Graphics g)
        {
            foreach (TextView.MarkerToDraw markerToDraw in this.markersToDraw)
            {
                TextMarker textMarker = markerToDraw.marker;
                RectangleF rectangleF = markerToDraw.drawingRect;
                float      bottom     = rectangleF.Bottom - 1f;
                switch (textMarker.TextMarkerType)
                {
                case TextMarkerType.SolidBlock:
                {
                    g.FillRectangle(BrushRegistry.GetBrush(textMarker.Color), rectangleF);
                    continue;
                }

                case TextMarkerType.Underlined:
                {
                    g.DrawLine(BrushRegistry.GetPen(textMarker.Color), rectangleF.X, bottom, rectangleF.Right, bottom);
                    continue;
                }

                case TextMarkerType.WaveLine:
                {
                    int x = (int)rectangleF.X % 6;
                    for (float i = (float)((int)rectangleF.X - x); i < rectangleF.Right; i += 6f)
                    {
                        g.DrawLine(BrushRegistry.GetPen(textMarker.Color), i, bottom + 3f - 4f, i + 3f, bottom + 1f - 4f);
                        if (i + 3f < rectangleF.Right)
                        {
                            g.DrawLine(BrushRegistry.GetPen(textMarker.Color), i + 3f, bottom + 1f - 4f, i + 6f, bottom + 3f - 4f);
                        }
                    }
                    continue;
                }

                default:
                {
                    continue;
                }
                }
            }
            this.markersToDraw.Clear();
        }
예제 #11
0
        public override void Paint(Graphics g, Rectangle rect)
        {
            if (rect.Width <= 0 || rect.Height <= 0)
            {
                return;
            }
            HighlightColor lineNumberPainterColor = textArea.Document.HighlightingStrategy.GetColorFor("LineNumbers");
            int            fontHeight             = textArea.TextView.FontHeight;
            Brush          fillBrush = textArea.Enabled ? BrushRegistry.GetBrush(lineNumberPainterColor.BackgroundColor) : SystemBrushes.InactiveBorder;
            Font           lineFont  = lineNumberPainterColor.GetFont(TextEditorProperties.FontContainer);

            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)
                {
                    Brush drawBrush = (curLine != textArea.Caret.Line)
                                                                                   ? BrushRegistry.GetBrush(lineNumberPainterColor.Color)
                                                                                   : drawBrush = BrushRegistry.GetBrush((textArea.Document.TextEditorProperties.DarkScheme) ? Color.Gold : Color.Blue);
                    g.DrawString((curLine + 1).ToString(),
                                 lineFont,
                                 drawBrush,
                                 backgroundRectangle,
                                 numberStringFormat);
                }
                //}
            }
            if (!textArea.Document.TextEditorProperties.EnableFolding)
            {
                g.DrawLine(BrushRegistry.GetPen(lineNumberPainterColor.Color),
                           rect.X + Size.Width - 3,
                           rect.Y,
                           rect.X + Size.Width - 3,
                           rect.Bottom);
            }
        }
예제 #12
0
        void PaintFoldMarker(Graphics g, int lineNumber, Rectangle drawingRectangle)
        {
            HighlightColor foldLineColor    = Shared.TEP.FoldLineColor;
            HighlightColor selectedFoldLine = Shared.TEP.SelectedFoldLineColor;

            List <FoldMarker> foldingsWithStart = TextArea.Document.FoldingManager.GetFoldingsWithStart(lineNumber);
            List <FoldMarker> foldingsBetween   = TextArea.Document.FoldingManager.GetFoldingsContainsLineNumber(lineNumber);
            List <FoldMarker> foldingsWithEnd   = TextArea.Document.FoldingManager.GetFoldingsWithEnd(lineNumber);

            bool isFoldStart = foldingsWithStart.Count > 0;
            bool isBetween   = foldingsBetween.Count > 0;
            bool isFoldEnd   = foldingsWithEnd.Count > 0;

            bool isStartSelected   = SelectedFoldingFrom(foldingsWithStart);
            bool isBetweenSelected = SelectedFoldingFrom(foldingsBetween);
            bool isEndSelected     = SelectedFoldingFrom(foldingsWithEnd);

            int foldMarkerSize = (int)Math.Round(TextArea._FontHeight * 0.57f);

            foldMarkerSize -= (foldMarkerSize) % 2;
            int foldMarkerYPos = drawingRectangle.Y + (int)((drawingRectangle.Height - foldMarkerSize) / 2);
            int xPos           = drawingRectangle.X + (drawingRectangle.Width - foldMarkerSize) / 2 + foldMarkerSize / 2;

            if (isFoldStart)
            {
                bool isVisible         = true;
                bool moreLinedOpenFold = false;
                foreach (FoldMarker foldMarker in foldingsWithStart)
                {
                    if (foldMarker.IsFolded)
                    {
                        isVisible = false;
                    }
                    else
                    {
                        moreLinedOpenFold = foldMarker.EndLine > foldMarker.StartLine;
                    }
                }

                bool isFoldEndFromUpperFold = false;
                foreach (FoldMarker foldMarker in foldingsWithEnd)
                {
                    if (foldMarker.EndLine > foldMarker.StartLine && !foldMarker.IsFolded)
                    {
                        isFoldEndFromUpperFold = true;
                    }
                }

                DrawFoldMarker(g, new RectangleF(drawingRectangle.X + (drawingRectangle.Width - foldMarkerSize) / 2,
                                                 foldMarkerYPos, foldMarkerSize, foldMarkerSize), isVisible, isStartSelected);

                // draw line above fold marker
                if (isBetween || isFoldEndFromUpperFold)
                {
                    g.DrawLine(BrushRegistry.GetPen(isBetweenSelected ? selectedFoldLine.Color : foldLineColor.Color),
                               xPos, drawingRectangle.Top, xPos, foldMarkerYPos - 1);
                }

                // draw line below fold marker
                if (isBetween || moreLinedOpenFold)
                {
                    g.DrawLine(BrushRegistry.GetPen(isEndSelected || (isStartSelected && isVisible) || isBetweenSelected ? selectedFoldLine.Color : foldLineColor.Color),
                               xPos, foldMarkerYPos + foldMarkerSize + 1, xPos, drawingRectangle.Bottom);
                }
            }
            else
            {
                if (isFoldEnd)
                {
                    int midy = drawingRectangle.Top + drawingRectangle.Height / 2;

                    // draw fold end marker
                    g.DrawLine(BrushRegistry.GetPen(isEndSelected ? selectedFoldLine.Color : foldLineColor.Color),
                               xPos,
                               midy,
                               xPos + foldMarkerSize / 2,
                               midy);

                    // draw line above fold end marker
                    // must be drawn after fold marker because it might have a different color than the fold marker
                    g.DrawLine(BrushRegistry.GetPen(isBetweenSelected || isEndSelected ? selectedFoldLine.Color : foldLineColor.Color),
                               xPos,
                               drawingRectangle.Top,
                               xPos,
                               midy);

                    // draw line below fold end marker
                    if (isBetween)
                    {
                        g.DrawLine(BrushRegistry.GetPen(isBetweenSelected ? selectedFoldLine.Color : foldLineColor.Color),
                                   xPos,
                                   midy + 1,
                                   xPos,
                                   drawingRectangle.Bottom);
                    }
                }
                else if (isBetween)
                {
                    // just draw the line :)
                    g.DrawLine(BrushRegistry.GetPen(isBetweenSelected ? selectedFoldLine.Color : foldLineColor.Color),
                               xPos,
                               drawingRectangle.Top,
                               xPos,
                               drawingRectangle.Bottom);
                }
            }
        }
        private void PaintFoldMarker(Graphics g, int lineNumber, Rectangle drawingRectangle)
        {
            HighlightColor    colorFor                   = this.textArea.Document.HighlightingStrategy.GetColorFor("FoldLine");
            HighlightColor    highlightColor             = this.textArea.Document.HighlightingStrategy.GetColorFor("SelectedFoldLine");
            List <FoldMarker> foldingsWithStart          = this.textArea.Document.FoldingManager.GetFoldingsWithStart(lineNumber);
            List <FoldMarker> foldingsContainsLineNumber = this.textArea.Document.FoldingManager.GetFoldingsContainsLineNumber(lineNumber);
            List <FoldMarker> foldingsWithEnd            = this.textArea.Document.FoldingManager.GetFoldingsWithEnd(lineNumber);
            bool count  = foldingsWithStart.Count > 0;
            bool flag   = foldingsContainsLineNumber.Count > 0;
            bool count1 = foldingsWithEnd.Count > 0;
            bool flag1  = this.SelectedFoldingFrom(foldingsWithStart);
            bool flag2  = this.SelectedFoldingFrom(foldingsContainsLineNumber);
            bool flag3  = this.SelectedFoldingFrom(foldingsWithEnd);
            int  num    = (int)Math.Round((double)((float)this.textArea.TextView.FontHeight * 0.57f));

            num = num - num % 2;
            int y = drawingRectangle.Y + (drawingRectangle.Height - num) / 2;
            int x = drawingRectangle.X + (drawingRectangle.Width - num) / 2 + num / 2;

            if (count)
            {
                bool flag4   = true;
                bool endLine = false;
                foreach (FoldMarker foldMarker in foldingsWithStart)
                {
                    if (!foldMarker.IsFolded)
                    {
                        endLine = foldMarker.EndLine > foldMarker.StartLine;
                    }
                    else
                    {
                        flag4 = false;
                    }
                }
                bool flag5 = false;
                foreach (FoldMarker foldMarker1 in foldingsWithEnd)
                {
                    if (foldMarker1.EndLine <= foldMarker1.StartLine || foldMarker1.IsFolded)
                    {
                        continue;
                    }
                    flag5 = true;
                }
                this.DrawFoldMarker(g, new RectangleF((float)(drawingRectangle.X + (drawingRectangle.Width - num) / 2), (float)y, (float)num, (float)num), flag4, flag1);
                if (flag || flag5)
                {
                    g.DrawLine(BrushRegistry.GetPen((flag2 ? highlightColor.Color : colorFor.Color)), x, drawingRectangle.Top, x, y - 1);
                }
                if (flag || endLine)
                {
                    g.DrawLine(BrushRegistry.GetPen((flag3 || flag1 && flag4 || flag2 ? highlightColor.Color : colorFor.Color)), x, y + num + 1, x, drawingRectangle.Bottom);
                    return;
                }
            }
            else if (count1)
            {
                int top = drawingRectangle.Top + drawingRectangle.Height / 2;
                g.DrawLine(BrushRegistry.GetPen((flag3 ? highlightColor.Color : colorFor.Color)), x, top, x + num / 2, top);
                g.DrawLine(BrushRegistry.GetPen((flag2 || flag3 ? highlightColor.Color : colorFor.Color)), x, drawingRectangle.Top, x, top);
                if (flag)
                {
                    g.DrawLine(BrushRegistry.GetPen((flag2 ? highlightColor.Color : colorFor.Color)), x, top + 1, x, drawingRectangle.Bottom);
                    return;
                }
            }
            else if (flag)
            {
                g.DrawLine(BrushRegistry.GetPen((flag2 ? highlightColor.Color : colorFor.Color)), x, drawingRectangle.Top, x, drawingRectangle.Bottom);
            }
        }
예제 #14
0
        private void PaintFoldMarker(Graphics g, int lineNumber, Rectangle drawingRectangle)
        {
            var foldLineColor = textArea.Document.HighlightingStrategy.GetColorFor("FoldLine");
            var selectedLine  = textArea.Document.HighlightingStrategy.GetColorFor("SelectedFoldLine");

            var foldingsWithStart = textArea.Document.FoldingManager.GetFoldingsWithStart(lineNumber);
            var foldingsBetween   = textArea.Document.FoldingManager.GetFoldingsContainsLineNumber(lineNumber);
            var foldingsWithEnd   = textArea.Document.FoldingManager.GetFoldingsWithEnd(lineNumber);

            var isFoldStart = foldingsWithStart.Count > 0;
            var isBetween   = foldingsBetween.Count > 0;
            var isFoldEnd   = foldingsWithEnd.Count > 0;

            var isStartSelected   = SelectedFoldingFrom(foldingsWithStart);
            var isBetweenSelected = SelectedFoldingFrom(foldingsBetween);
            var isEndSelected     = SelectedFoldingFrom(foldingsWithEnd);

            bool SelectedFoldingFrom(IEnumerable <FoldMarker> list)
            => list?.Any(t => selectedFoldLine == t.StartLine) == true;

            var foldMarkerSize = (int)Math.Round(textArea.TextView.FontHeight * 0.57f);

            foldMarkerSize -= foldMarkerSize % 2;
            var foldMarkerYPos = drawingRectangle.Y + (drawingRectangle.Height - foldMarkerSize) / 2;
            var xPos           = drawingRectangle.X + (drawingRectangle.Width - foldMarkerSize) / 2 + foldMarkerSize / 2;

            if (isFoldStart)
            {
                var isVisible         = true;
                var moreLinedOpenFold = false;
                foreach (var foldMarker in foldingsWithStart)
                {
                    if (foldMarker.IsFolded)
                    {
                        isVisible = false;
                    }
                    else
                    {
                        moreLinedOpenFold = foldMarker.EndLine > foldMarker.StartLine;
                    }
                }

                var isFoldEndFromUpperFold = false;
                foreach (var foldMarker in foldingsWithEnd)
                {
                    if (foldMarker.EndLine > foldMarker.StartLine && !foldMarker.IsFolded)
                    {
                        isFoldEndFromUpperFold = true;
                    }
                }

                DrawFoldMarker(
                    g, new RectangleF(
                        drawingRectangle.X + (drawingRectangle.Width - foldMarkerSize) / 2,
                        foldMarkerYPos,
                        foldMarkerSize,
                        foldMarkerSize),
                    isVisible,
                    isStartSelected
                    );

                // draw line above fold marker
                if (isBetween || isFoldEndFromUpperFold)
                {
                    g.DrawLine(
                        BrushRegistry.GetPen(isBetweenSelected ? selectedLine.Color : foldLineColor.Color),
                        xPos,
                        drawingRectangle.Top,
                        xPos,
                        foldMarkerYPos - 1);
                }

                // draw line below fold marker
                if (isBetween || moreLinedOpenFold)
                {
                    g.DrawLine(
                        BrushRegistry.GetPen(isEndSelected || isStartSelected && isVisible || isBetweenSelected ? selectedLine.Color : foldLineColor.Color),
                        xPos,
                        foldMarkerYPos + foldMarkerSize + 1,
                        xPos,
                        drawingRectangle.Bottom);
                }
            }
            else
            {
                if (isFoldEnd)
                {
                    var midy = drawingRectangle.Top + drawingRectangle.Height / 2;

                    // draw fold end marker
                    g.DrawLine(
                        BrushRegistry.GetPen(isEndSelected ? selectedLine.Color : foldLineColor.Color),
                        xPos,
                        midy,
                        xPos + foldMarkerSize / 2,
                        midy);

                    // draw line above fold end marker
                    // must be drawn after fold marker because it might have a different color than the fold marker
                    g.DrawLine(
                        BrushRegistry.GetPen(isBetweenSelected || isEndSelected ? selectedLine.Color : foldLineColor.Color),
                        xPos,
                        drawingRectangle.Top,
                        xPos,
                        midy);

                    // draw line below fold end marker
                    if (isBetween)
                    {
                        g.DrawLine(
                            BrushRegistry.GetPen(isBetweenSelected ? selectedLine.Color : foldLineColor.Color),
                            xPos,
                            midy + 1,
                            xPos,
                            drawingRectangle.Bottom);
                    }
                }
                else if (isBetween)
                {
                    // just draw the line :)
                    g.DrawLine(
                        BrushRegistry.GetPen(isBetweenSelected ? selectedLine.Color : foldLineColor.Color),
                        xPos,
                        drawingRectangle.Top,
                        xPos,
                        drawingRectangle.Bottom);
                }
            }
        }