Exemplo n.º 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);
     }
 }
Exemplo n.º 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;
     }
 }