Alsing.Windows.Forms.SyntaxBox.Painter.NativePainter.RenderCollapsedSelectedText C# (CSharp) Method

RenderCollapsedSelectedText() private method

private RenderCollapsedSelectedText ( int RowIndex, int xPos ) : void
RowIndex int
xPos int
return void
        private void RenderCollapsedSelectedText(int RowIndex, int xPos)
        {
            GDISurface bbuff = GFX.SelectionBuffer;
            bbuff.Font = GFX.FontBold;
            bbuff.FontTransparent = true;

            bbuff.TextForeColor = Control.ContainsFocus ? Control.SelectionForeColor : Control.InactiveSelectionForeColor;

            //bbuff.TextForeColor =Color.DarkBlue;
            Row r = Control.Document[RowIndex];
            string str = r.CollapsedText;

            xPos++;
            int taborig = -Control.View.FirstVisibleColumn*Control.View.CharWidth + Control.View.TextMargin;
            GFX.StringBuffer.Font = GFX.FontBold;
            int wdh = GFX.StringBuffer.DrawTabbedString(str, xPos + 1, 0, taborig, Control.PixelTabSize).Width;

            if (Control.ContainsFocus)
            {
                bbuff.FillRect(Control.SelectionForeColor, xPos + 0, 0, wdh + 2, Control.View.RowHeight);
                bbuff.FillRect(Control.SelectionBackColor, xPos + 1, 1, wdh, Control.View.RowHeight - 2);
            }
            else
            {
                bbuff.FillRect(Control.InactiveSelectionForeColor, xPos + 0, 0, wdh + 2, Control.View.RowHeight);
                bbuff.FillRect(Control.InactiveSelectionBackColor, xPos + 1, 1, wdh, Control.View.RowHeight - 2);
            }


            wdh = bbuff.DrawTabbedString(str, xPos + 1, 0, taborig, Control.PixelTabSize).Width;


            //this can crash if document not fully parsed , on error resume next
            try
            {
                if (r.expansion_StartSpan.EndRow != null)
                {
                    if (r.expansion_StartSpan.EndRow.RowState == RowState.SpanParsed)
                        Control.Document.Parser.ParseRow(r.expansion_StartSpan.EndRow.Index, true);

                    Word last = r.expansion_StartSpan.EndWord;
                    xPos += Control.View.FirstVisibleColumn*Control.View.CharWidth;
                    r.expansion_StartSpan.EndRow.Expansion_PixelStart = xPos + wdh - Control.View.TextMargin + 2;
                    r.Expansion_PixelEnd = xPos - 1;
                    RenderSelectedText(Control.Document.IndexOf(r.expansion_StartSpan.EndRow), r.expansion_StartSpan.EndRow.Expansion_PixelStart, last);
                }
            }
            catch {}
        }