88 lines
3.7 KiB
C#
88 lines
3.7 KiB
C#
|
|
using System;
|
|||
|
|
using System.Collections.Generic;
|
|||
|
|
using System.Linq;
|
|||
|
|
using System.Text;
|
|||
|
|
using System.Windows.Forms;
|
|||
|
|
|
|||
|
|
namespace VSoft.Prams
|
|||
|
|
{
|
|||
|
|
public static class Msg
|
|||
|
|
{
|
|||
|
|
/// <summary>
|
|||
|
|
/// 显示对话框
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="msgText"></param>
|
|||
|
|
/// <param name="title"></param>
|
|||
|
|
/// <returns></returns>
|
|||
|
|
public static DialogResult ShowMsg(string msgText, string title)
|
|||
|
|
{
|
|||
|
|
return ShowMsg(msgText, title, MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|||
|
|
}
|
|||
|
|
/// <summary>
|
|||
|
|
/// 显示对话框
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="msgText"></param>
|
|||
|
|
/// <param name="title"></param>
|
|||
|
|
/// <param name="button"></param>
|
|||
|
|
/// <returns></returns>
|
|||
|
|
public static DialogResult ShowMsg(string msgText, string title, MessageBoxButtons button)
|
|||
|
|
{
|
|||
|
|
return ShowMsg(msgText, title, button, MessageBoxIcon.Information);
|
|||
|
|
}
|
|||
|
|
/// <summary>
|
|||
|
|
/// 显示对话框
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="msgText"></param>
|
|||
|
|
/// <param name="title"></param>
|
|||
|
|
/// <param name="button"></param>
|
|||
|
|
/// <param name="Icon"></param>
|
|||
|
|
/// <param name="defaultButton"></param>
|
|||
|
|
/// <returns></returns>
|
|||
|
|
public static DialogResult ShowMsg(string msgText, string title, MessageBoxButtons button, MessageBoxIcon Icon,MessageBoxDefaultButton defaultButton)
|
|||
|
|
{
|
|||
|
|
return ShowMsg(msgText, title, button, Icon);
|
|||
|
|
}
|
|||
|
|
/// <summary>
|
|||
|
|
/// 显示对话框
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="msgText"></param>
|
|||
|
|
/// <param name="title"></param>
|
|||
|
|
/// <param name="button"></param>
|
|||
|
|
/// <param name="Icon"></param>
|
|||
|
|
/// <returns></returns>
|
|||
|
|
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();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|