- using System;
- using System.Windows.Forms;
- namespace Cjf.Tool
- {
- /// <summary>
- /// 简化消息框的调用
- /// </summary>
- public class Msg
- {
- #region - 简化消息框的调用 -
- public static void MessageBox_Warning(string aMessage, string aTitle="")
- {
- MessageBox.Show(aMessage, aTitle, MessageBoxButtons.OK, MessageBoxIcon.Warning);
- }
- public static void MessageBox_Error(string aMessage, string aTitle = "")
- {
- MessageBox.Show(aMessage, aTitle, MessageBoxButtons.OK, MessageBoxIcon.Error);
- }
- public static void MessageBox_Information(string aMessage, string aTitle = "")
- {
- MessageBox.Show(aMessage, aTitle, MessageBoxButtons.OK, MessageBoxIcon.Information);
- }
- public static void MessageBox_Asterisk(string aMessage, string aTitle = "")
- {
- MessageBox.Show(aMessage, aTitle, MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
- }
- public static void MessageBox_Exclamation(string aMessage, string aTitle = "")
- {
- MessageBox.Show(aMessage, aTitle, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
- }
- public static void MessageBox_Hand(string aMessage, string aTitle = "")
- {
- MessageBox.Show(aMessage, aTitle, MessageBoxButtons.OK, MessageBoxIcon.Hand);
- }
- public static void MessageBox_None(string aMessage, string aTitle = "")
- {
- MessageBox.Show(aMessage, aTitle, MessageBoxButtons.OK, MessageBoxIcon.None);
- }
- public static void MessageBox_Stop(string aMessage, string aTitle = "")
- {
- MessageBox.Show(aMessage, aTitle, MessageBoxButtons.OK, MessageBoxIcon.Stop);
- }
- public static DialogResult MessageBox_OKCancel(string aMessage, string aTitle = "")
- {
- return MessageBox.Show(aMessage, aTitle, MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
- }
- public static DialogResult MessageBox_YesNo(string aMessage, string aTitle = "")
- {
- return MessageBox.Show(aMessage, aTitle, MessageBoxButtons.YesNo, MessageBoxIcon.Question);
- }
- public static DialogResult MessageBox_RetryCancel(string aMessage, string aTitle = "")
- {
- return MessageBox.Show(aMessage, aTitle, MessageBoxButtons.RetryCancel, MessageBoxIcon.Question);
- }
- public static DialogResult MessageBox_YesNoCancel(string aMessage, string aTitle = "")
- {
- return MessageBox.Show(aMessage, aTitle, MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
- }
- public static DialogResult MessageBox_AbortRetryIgnore(string aMessage, string aTitle = "")
- {
- return MessageBox.Show(aMessage, aTitle, MessageBoxButtons.AbortRetryIgnore, MessageBoxIcon.Question);
- }
- #endregion
- }
- }
- //该片段来自于http://www.codesnippet.cn/detail/2407201513222.html
来源: http://www.codesnippet.cn/detail/2407201513222.html