滚动条自动处于TextBox最下部需要在Form1类中加上下段代码:
private void txtReceiveMsgChanged(object sender, EventArgs e)
{
//文本框选中的起始点在最后
txtReceiveMsg.SelectionStart = txtReceiveMsg.TextLength;
//将控件内容滚动到当前插入符号位置
txtReceiveMsg.ScrollToCaret();
}
然后,需要在Form的窗体设计器生成的代码中(#region Windows 窗体设计器生成的代码下)
找到对应TextBox框的部分,在下方加上:
this.txtReceiveMsg.TextChanged += new System.EventHandler(this.txtReceiveMsgChanged);