日期:2014-05-17 浏览次数:21009 次
private void btnTest_Click(object sender, EventArgs e)
{
// 这里控制显示行数
richTextBox1.Lines = richTextBox1.Lines.Take(20).ToArray();
}
private void Form1_Load(object sender, EventArgs e)
{
string[] arr = new string[100];
for (int i = 0; i < 100; i++)
{
arr[i] = i.ToString();
}
richTextBox1.Lines = arr;
}
private void richTextBox1_TextChanged(object sender, EventArgs e)
{
List<string> TempLi = new List<string>();
if (richTextBox1.Lines.Length > 10)
{
TempLi.AddRange(richTextBox1.Lines);
richTextBox1.Lines = TempLi.GetRange(richTextBox1.Lines.Length - 10, 10).ToArray();
richTextBox1.Select(richTextBox1.Text.Length - 1, 0);
}
}