聊天窗体
textBox1.ScrollBars = ScrollBars.Vertical;设置文本框内容超过文本框范围时出现竖直滚动条
textBox1.ReadOnly = true;设置文本框为只读
textBox1.TabIndex = 0;设置光标默认出现在此文本框
textBox1.Multiline = true;设置文本框可多行输入
“\r\n”表示换行
DateTime,表示获取当前时间
代码
private void Form2_Load(object sender, EventArgs e)
{
this.Text = "QQ窗口";
this.Left = Screen.PrimaryScreen.WorkingArea.Width / 2 - this.Width / 2;
this.Top = Screen.PrimaryScreen.WorkingArea.Height / 2 - this.Height / 2;
textBox1.ScrollBars = ScrollBars.Vertical;
textBox1.ReadOnly = true;
textBox2.TabIndex = 0;
}
private void button1_Click(object sender, EventArgs e)
{
//窗口抖动
int x = this.Left;
int y = this.Top;
//循环
for (int i = 0; i <= 5; i