예제 #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 = "请输入提示信息",
     string caption = "提示",
     QQMessageBoxIcon msgBoxIcon = QQMessageBoxIcon.Information,
     QQMessageBoxButtons msgBoxButtons = QQMessageBoxButtons.OK)
 {
     using (QQMessageBox msgBox = new QQMessageBox(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;
             }
         }
         else
         {
             msgBox.StartPosition = FormStartPosition.CenterScreen;
         }
         msgBox.ShowDialog();
         return msgBox.DialogResult;
     }
 }
예제 #2
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 = "请输入提示信息",
     string caption = "提示",
     QQMessageBoxIcon msgBoxIcon       = QQMessageBoxIcon.Information,
     QQMessageBoxButtons msgBoxButtons = QQMessageBoxButtons.OK)
 {
     using (QQMessageBox msgBox = new QQMessageBox(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;
             }
         }
         else
         {
             msgBox.StartPosition = FormStartPosition.CenterScreen;
         }
         msgBox.ShowDialog();
         return(msgBox.DialogResult);
     }
 }
예제 #3
0
 public QQMessageBox(string msgText, string caption, QQMessageBoxIcon msgBoxIcon, QQMessageBoxButtons msgBoxButtons)
 {
     this.MessageText = msgText;
     this.Text = caption;
     LoadMsgBoxIcon(msgBoxIcon);
     LoadMsgBoxButtons(msgBoxButtons);
     InitializeComponent();
 }
예제 #4
0
        private void LoadMsgBoxButtons(QQMessageBoxButtons msgBoxButtons)
        {
            switch (msgBoxButtons)
            {
            case QQMessageBoxButtons.OK:
                this.CreateOKButton();
                break;

            case QQMessageBoxButtons.OKCancel:
                this.CreateOKCancelButton();
                break;

            case QQMessageBoxButtons.RetryCancel:
                this.CreateRetryCancleButton();
                break;
            }
        }
예제 #5
0
 public QQMessageBox(string msgText, string caption, QQMessageBoxIcon msgBoxIcon, QQMessageBoxButtons msgBoxButtons)
 {
     this.MessageText = msgText;
     this.Text        = caption;
     LoadMsgBoxIcon(msgBoxIcon);
     LoadMsgBoxButtons(msgBoxButtons);
     InitializeComponent();
 }
예제 #6
0
 private void LoadMsgBoxButtons(QQMessageBoxButtons msgBoxButtons)
 {
     switch (msgBoxButtons)
     {
         case QQMessageBoxButtons.OK:
             CreateOKButton();
             break;
         case QQMessageBoxButtons.OKCancel:
             CreateOKCancelButton();
             break;
         case QQMessageBoxButtons.RetryCancel:
             CreateRetryCancleButton();
             break;
         default:
             break;
     }
 }
예제 #7
0
 public QQMessageBox(string msgText, string caption, QQMessageBoxIcon msgBoxIcon, QQMessageBoxButtons msgBoxButtons)
 {
     this.MessageText = msgText;
     this.Text        = caption;
     LoadMsgBoxIcon(msgBoxIcon);
     LoadMsgBoxButtons(msgBoxButtons);
     this.TopMost = false;
     this.BringToFront();
     this.TopMost = true;
     InitializeComponent();
 }