1. 准备好样式
样式链接地址:C#创建Windows窗体应用程序实例1https://blog.youkuaiyun.com/qq_45037155/article/details/124005398
2. 一个参数
MessageBox.Show(textBox1.Text + " 登录成功!");
private void button1_Click(object sender, EventArgs e) { MessageBox.Show(textBox1.Text + " 登录成功!"); }
3. 二个参数
MessageBox.Show(textBox1.Text + " 登录成功!","登录提醒");
private void button1_Click(object sender, EventArgs e) { MessageBox.Show(textBox1.Text + " 登录成功!","登录提醒"); }
4. 三个参数
MessageBox.Show(textBox1.Text + " 登录成功!","登录提醒",MessageBoxButtons.YesNo);
private void button1_Click(object sender, EventArgs e) { MessageBox.Show(textBox1.Text + " 登录成功!","登录提醒",MessageBoxButtons.YesNo); }
5. 四个参数
MessageBox.Show(textBox1.Text + " 登录成功!","登录提醒",MessageBoxButtons.YesNo,MessageBoxIcon.Question);
private void button1_Click(object sender, EventArgs e) { MessageBox.Show(textBox1.Text + " 登录成功!","登录提醒",MessageBoxButtons.YesNo,MessageBoxIcon.Question); }