限制RichTextBox的行數方法
阿新 • • 發佈:2019-02-03
主要程式碼:
this.richTextBox_query_txt.AppendText("" + r.Next(100000, 999999999) + "\n"); int maxLinds = 3; if (this.richTextBox_query_txt.Lines.Length > maxLinds) { int moreLines = this.richTextBox_query_txt.Lines.Length - maxLinds; string[] lines = this.richTextBox_query_txt.Lines; Array.Copy(lines, moreLines, lines, 0, maxLinds); Array.Resize(ref lines, maxLinds); this.richTextBox_query_txt.Lines = lines; }