#region using System; using System.Windows.Forms; #endregion namespace CSFrameworkV5.Library.UIForm { public partial class MsgEx : frmBaseUI { private DialogResult _Result = DialogResult.OK; private MsgEx() { InitializeComponent(); } private void btnCancel_Click(object sender, EventArgs e) { _Result = DialogResult.Cancel; Close(); } private void btnOK_Click(object sender, EventArgs e) { _Result = DialogResult.OK; Close(); } public static void ShowError(string msg, string title = "错误消息") { var form = new MsgEx(); form.lblMsg.Text = msg; form.Text = title; form.TitleText = title; form.pic.Image = form.picERR.Image; //图片 form.ShowDialog(); } public static void ShowInformation(string msg, string title = "普通消息") { var form = new MsgEx(); form.lblMsg.Text = msg; form.Text = title; form.TitleText = title; form.pic.Image = form.picInfo.Image; //图片 form.ShowDialog(); } public static bool ShowQuestion(string msg, string title = "对话框") { var form = new MsgEx(); form.lblMsg.Text = msg; form.Text = title; form.TitleText = title; form.pic.Image = form.picQue.Image; //图片 form.ShowDialog(); return form._Result == DialogResult.OK; } public static void ShowWaring(string msg, string title = "系统警告") { var form = new MsgEx(); form.lblMsg.Text = msg; form.Text = title; form.TitleText = title; form.pic.Image = form.picWar.Image; //图片 form.ShowDialog(); } } }