MessageBox的四个对话框

using System;

using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;

namespace Austec.ToolCollection
{
    public class Message
    {
        /// <summary>
        /// 弹出错误提示框
        /// </summary>
        /// <param name="str">提示错误信息</param>
        public static void Error(string content)
        {
            Error(content, "错误");
        }

        /// <summary>
        /// 弹出错误提示框
        /// </summary>
        /// <param name="str">提示错误信息</param>
        /// <param name="title">显示标题</param>
        public static void Error(string content, string title)
        {
            System.Windows.Forms.MessageBox.Show(content, title, System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Hand, MessageBoxDefaultButton.Button1);
        }

        /// <summary>
        /// 报告一个警告
        /// </summary>
        /// <param name="strMsg"></param>
        public static void Exclamation(string content)
        {
            System.Windows.Forms.MessageBox.Show(content, "警告", System.Windows.Forms.MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
        }
        /// <summary>
        /// 报告一个提示
        /// </summary>
        /// <param name="strMsg"></param>
        public static void Success(string content)
        {
            System.Windows.Forms.MessageBox.Show(content, "提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Asterisk, MessageBoxDefaultButton.Button1);
        }

        public static bool AskQuestion(string content)
        {
            DialogResult dialogResult = MessageBox.Show(content, "提问", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1);
            if (dialogResult == DialogResult.Yes)
                return true;
            else
                return false;
        }
    }
}

你可能感兴趣的:(MessageBox的四个对话框)