Beispiel #1
0
 /// <summary>
 /// 显示QQMessageBox消息框
 /// </summary>
 /// <param name="owner">父窗体,默认为null,设置此参数可更改消息框的背景图与父窗体一致</param>
 /// <param name="msgText">提示文本</param>
 /// <param name="caption">消息框的标题</param>
 /// <param name="msgBoxIcon">消息框的图标枚举</param>
 /// <param name="msgBoxButtons">消息框的按钮,此值可为MessageBoxButtons.OK,MessageBoxButtons.OKCancelMessageBoxButtons.RetryCancel</param>
 public static DialogResult Show(
     Form owner = null,
     string msgText = "请输入提示信息",
     NuiBlueMessageBoxIcon msgBoxIcon = NuiBlueMessageBoxIcon.Information,
     NuiBlueMessageBoxButtons msgBoxButtons = NuiBlueMessageBoxButtons.OK,
     string caption = "提示")
 {
     using (NuiBlueMessageBox msgBox = new NuiBlueMessageBox(msgText, caption, msgBoxIcon, msgBoxButtons))
     {
         if (owner != null)
         {
             msgBox.StartPosition = FormStartPosition.CenterParent;
             if (owner.BackgroundImage != null)
             {
                 //使用父窗体的背景图片
                 MsgBoxBackgroundImg = owner.BackgroundImage;
             }
             if (owner.Icon != null)
             {
                 msgBox.Icon = owner.Icon;
                 msgBox.IsDrawIcon = true;
             }
         }
         else
         {
             msgBox.StartPosition = FormStartPosition.CenterScreen;
         }
         msgBox.ShowDialog();
         return msgBox.DialogResult;
     }
 }
Beispiel #2
0
 public NuiBlueMessageBox(string msgText, string caption, NuiBlueMessageBoxIcon msgBoxIcon, NuiBlueMessageBoxButtons msgBoxButtons)
 {
     this.IsCanMove = true;
     this.IsCanResize = false;
     this.IsShowMaxOrRestoreButton = false;
     this.IsShowMinButton = false;
     this.IsDrawIcon = false;
     this.MessageText = msgText;
     this.Text = caption;
     LoadMsgBoxIcon(msgBoxIcon);
     LoadMsgBoxButtons(msgBoxButtons);
     InitializeComponent();
 }
Beispiel #3
0
 private void LoadMsgBoxIcon(NuiBlueMessageBoxIcon icon)
 {
     switch (icon)
     {
         case NuiBlueMessageBoxIcon.Error:
             msgBoxIcon = Properties.Resources.blue_msgbox_error;
             break;
         case NuiBlueMessageBoxIcon.Information:
             msgBoxIcon = Properties.Resources.blue_msgbox_info;
             break;
         case NuiBlueMessageBoxIcon.OK:
             msgBoxIcon = Properties.Resources.blue_msgbox_ok;
             break;
         case NuiBlueMessageBoxIcon.Question:
             msgBoxIcon = Properties.Resources.blue_msgbox_question;
             break;
         case NuiBlueMessageBoxIcon.Warning:
             msgBoxIcon = Properties.Resources.blue_msgbox_warning;
             break;
         default:
             break;
     }
 }