I want to keep a certain number of lines in the richtextbox, so I did the following:
private void txt_Log_TextChanged(object sender, EventArgs e)
{
int max_lines = 200;
if (txt_Log.Lines.Length > max_lines)
{
string[] newLines = new string[max_lines];
Array.Copy(txt_Log.Lines, 1, newLines, 0, max_lines);
txt_Log.Lines = newLines;
}
txt_Log.SelectionStart = txt_Log.Text.Length;
txt_Log.ScrollToCaret();
}
But when running my Richtextnbox blinks continuously, so how should I make this smooth ?