removing RichTextBox lines while keeping the colour of remaining lines in C#

前端 未结 3 1315
遥遥无期
遥遥无期 2020-12-11 23:09

Consider a RichTextBox which has 400 lines and includes a number of words and lines in diffident colours.

Is it possible to remove the first 100 lines of this text b

3条回答
  •  悲哀的现实
    2020-12-12 00:06

    .SelectedText = "" throws a Windows ding in my application

    So I found a second solution which is to play with .Lines property

    if (nbLines > maxLines)
    {
        Array.Copy(rtfBox.Lines, 1,
                   rtfBox.Lines, 0, rtfBox.Lines.Length - 1);
    }
    

提交回复
热议问题