C# Winform编程(3)对话框

C# Winform编程(3)对话框

  • Show(string text);
  • Show(string text, string caption);
  • Show(string text, string caption, MessageBoxButtons buttons);
  • Show(string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon);
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace 对话框
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {

        }

        private void button1_Click(object sender, EventArgs e)
        {
            MessageBox.Show("只有消息文本的对话框!");
        }

        private void button2_Click(object sender, EventArgs e)
        {
            MessageBox.Show("消息文本", "标题");
        }

        private void button3_Click(object sender, EventArgs e)
        {
            MessageBox.Show("消息文本", "标题", MessageBoxButtons.OK);
        }

        private void button4_Click(object sender, EventArgs e)
        {
            MessageBox.Show("消息文本", "标题", MessageBoxButtons.OKCancel);
        }

        private void button5_Click(object sender, EventArgs e)
        {
            MessageBox.Show("消息文本", "标题", MessageBoxButtons.YesNo);
        }

        private void button6_Click(object sender, EventArgs e)
        {
            MessageBox.Show("消息文本", "标题", MessageBoxButtons.YesNoCancel);
        }

        private void button7_Click(object sender, EventArgs e)
        {
            MessageBox.Show("消息文本", "标题", MessageBoxButtons.RetryCancel);
        }

        private void button8_Click(object sender, EventArgs e)
        {
            MessageBox.Show("消息文本", "标题", MessageBoxButtons.AbortRetryIgnore);
        }

        private void button9_Click(object sender, EventArgs e)
        {
            MessageBox.Show("消息文本", "标题", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
        }

        private void button10_Click(object sender, EventArgs e)
        {
            MessageBox.Show("消息文本", "标题", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
        }

        private void button11_Click(object sender, EventArgs e)
        {
            MessageBox.Show("消息文本", "标题", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
        }

        private void button12_Click(object sender, EventArgs e)
        {
            MessageBox.Show("消息文本", "标题", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation);
        }
    }
}

C# Winform编程(3)对话框_第1张图片

你可能感兴趣的:(C#,c#,开发语言)