日期:2014-05-18 浏览次数:21068 次
private void addlog(string str)
{
string strTxtLog = textBoxLog.Text;
textBoxLog.Text = "[" + DateTime.Now.ToString() + "]" + str + "\r\n" + strTxtLog;
dellog();
}
private void dellog()
{
//实现textBoxLog行数超过100行自动删除100行以后的数据。
}
int limitLineCount = 2;
if (textBox1.Lines.Count() > limitLineCount)
{
this.textBox1.Text = string.Join("\r\n", this.textBox1.Lines.Take(limitLineCount));
}
------解决方案--------------------
int count = this.richTextBox1.Lines.Length;
if (count > 2)
{
string[] str = this.richTextBox1.Lines;
this.richTextBox1.Lines = new string[] { str[0], str[1] };
}
楼上this.textBox1.Lines.Take(limitLineCount) Take 函数 是 4.0编译器的?