1、C#弹出的各种对话框using System;using System.Data;using System.Configuration;using System.Web;using System.Web.Security;using System.Web.UI;using System.Web.UI.WebControls;using System.Web.UI.WebControls.WebParts;using System.Web.UI.HtmlControls;using System.Windows.Forms;/ / Dialog 的摘要说明/ public class Dialo
2、gpublic Dialog()/ TODO: 在此处添加构造函数逻辑/ / 显示提示消息/ / 内容public static void ShowInfo(object msg)System.Windows.Forms.MessageBox.Show(msg.ToString(), “消息“, MessageBoxButtons.OK, MessageBoxIcon.Information);/ / 显示错误信息/ / 内容public static void ShowError(object msg)System.Windows.Forms.MessageBox.Show(msg.ToSt
3、ring(), “错误“, MessageBoxButtons.OK, MessageBoxIcon.Error);/ / 显示警告信息/ / 内容public static void ShowWarning(object msg)System.Windows.Forms.MessageBox.Show(msg.ToString(), “警告“, MessageBoxButtons.OK, MessageBoxIcon.Warning);/ / 显示 YES,NO 对话框/ / Question Content/ bool值public static bool ShowQuestionYesN
4、o(object msg)DialogResult dr = System.Windows.Forms.MessageBox.Show(msg.ToString(), “提示“, MessageBoxButtons.YesNo, MessageBoxIcon.Question);if (dr = DialogResult.Yes)return true;elsereturn false;/ / 显示 OkCancel提问对话框/ / Question Content/ bool值public static bool ShowQuestionOkCancel(object msg)DialogR
5、esult dr = System.Windows.Forms.MessageBox.Show(msg.ToString(), “提示“, MessageBoxButtons.OKCancel, MessageBoxIcon.Question);if (dr = DialogResult.OK)return true;elsereturn false;/ / 显示 YesNoCancel对话框/ / Question Content/ DialogResultpublic static DialogResult ShowQuestionYesNoCancel(object msg)return
6、 System.Windows.Forms.MessageBox.Show(msg.ToString(), “提示“, MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);using System;using System.Data;using System.Configuration;using System.Web;using System.Web.Security;using System.Web.UI;using System.Web.UI.WebControls;using System.Web.UI.WebControls
7、.WebParts;using System.Web.UI.HtmlControls;using System.Windows.Forms;/ / Dialog 的摘要说明/ public class Dialogpublic Dialog()/ TODO: 在此处添加构造函数逻辑/ / 显示提示消息/ / 内容public static void ShowInfo(object msg)System.Windows.Forms.MessageBox.Show(msg.ToString(), “消息“, MessageBoxButtons.OK, MessageBoxIcon.Informat
8、ion);/ / 显示错误信息/ / 内容public static void ShowError(object msg)System.Windows.Forms.MessageBox.Show(msg.ToString(), “错误“, MessageBoxButtons.OK, MessageBoxIcon.Error);/ / 显示警告信息/ / 内容public static void ShowWarning(object msg)System.Windows.Forms.MessageBox.Show(msg.ToString(), “警告“, MessageBoxButtons.O
9、K, MessageBoxIcon.Warning);/ / 显示 YES,NO 对话框/ / Question Content/ bool值public static bool ShowQuestionYesNo(object msg)DialogResult dr = System.Windows.Forms.MessageBox.Show(msg.ToString(), “提示“, MessageBoxButtons.YesNo, MessageBoxIcon.Question);if (dr = DialogResult.Yes)return true;elsereturn false
10、;/ / 显示 OkCancel提问对话框/ / Question Content/ bool值public static bool ShowQuestionOkCancel(object msg)DialogResult dr = System.Windows.Forms.MessageBox.Show(msg.ToString(), “提示“, MessageBoxButtons.OKCancel, MessageBoxIcon.Question);if (dr = DialogResult.OK)return true;elsereturn false;/ / 显示 YesNoCancel对话框/ / Question Content/ DialogResultpublic static DialogResult ShowQuestionYesNoCancel(object msg)return System.Windows.Forms.MessageBox.Show(msg.ToString(), “提示“, MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);