Beispiel #1
0
 private void GetTopAndBottomLineNums(FastColoredTextBox tb, out int top, out int bot)
 {
     int iTopLine = tb.YtoLineIndex();
     int iLine = iTopLine;
     int countVisibleLines = tb.ClientSize.Height / tb.CharHeight;
     Line line = tb.GetRealLine(iLine);
     while (line.Unavaliable && iLine > 0) {
         iLine--;
         line = tb.GetRealLine(iLine);
     }
     top = Math.Max(line.LineNo - 1, 0);
     bot = top;
     for (int i = 0; i <= countVisibleLines; i++) {
         iLine = iTopLine + i;
         if (iLine >= tb.LinesCount) break;
         line = tb.GetRealLine(iLine);
         if (!line.Unavaliable) bot = line.LineNo - 1;
     }
     bot++;
 }