using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows.Forms; namespace VSoft.Prams { public static class Msg { /// /// 显示对话框 /// /// /// /// public static DialogResult ShowMsg(string msgText, string title) { return ShowMsg(msgText, title, MessageBoxButtons.OK, MessageBoxIcon.Information); } /// /// 显示对话框 /// /// /// /// /// public static DialogResult ShowMsg(string msgText, string title, MessageBoxButtons button) { return ShowMsg(msgText, title, button, MessageBoxIcon.Information); } /// /// 显示对话框 /// /// /// /// /// /// /// public static DialogResult ShowMsg(string msgText, string title, MessageBoxButtons button, MessageBoxIcon Icon,MessageBoxDefaultButton defaultButton) { return ShowMsg(msgText, title, button, Icon); } /// /// 显示对话框 /// /// /// /// /// /// public static DialogResult ShowMsg(string msgText, string title, MessageBoxButtons button, MessageBoxIcon Icon) { Skins.FrmMessageBox frm = new Skins.FrmMessageBox { Text = title }; frm.lblMsg.Text = msgText; frm.lblMsg.UpdateInfo(); frm.ResultDg = button; switch (button) { case MessageBoxButtons.OK: frm.btnYes.Location = new System.Drawing.Point(frm.ClientSize.Width - frm.btnYes.Width - 8, frm.ClientSize.Height - frm.btnYes.Height - 8); frm.btnCancel.Visible = false; break; case MessageBoxButtons.OKCancel: case MessageBoxButtons.YesNo: frm.btnCancel.Location = new System.Drawing.Point(frm.ClientSize.Width - frm.btnYes.Width - 8, frm.ClientSize.Height - frm.btnYes.Height - 8); frm.btnYes.Location = new System.Drawing.Point(frm.btnCancel.Left - frm.btnYes.Width - 8, frm.btnCancel.Top); break; case MessageBoxButtons.RetryCancel: frm.btnCancel.Location = new System.Drawing.Point(frm.ClientSize.Width - frm.btnYes.Width - 8, frm.ClientSize.Height - frm.btnYes.Height - 8); frm.btnYes.Location = new System.Drawing.Point(frm.btnCancel.Left - frm.btnYes.Width - 8, frm.btnCancel.Top); frm.btnYes.Text = "重试"; break; default: frm.btnYes.Location = new System.Drawing.Point(frm.ClientSize.Width - frm.btnYes.Width - 8, frm.ClientSize.Height - frm.btnYes.Height - 8); frm.btnCancel.Visible = false; break; } if (frm.Owner == null) { frm.StartPosition = FormStartPosition.CenterScreen; } return frm.ShowDialog(); } } }