コード例 #1
0
ファイル: NuiBlueMessageBox.cs プロジェクト: yienit/KST
 /// <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;
     }
 }
コード例 #2
0
ファイル: NuiBlueMessageBox.cs プロジェクト: yienit/KST
 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();
 }
コード例 #3
0
ファイル: NuiBlueMessageBox.cs プロジェクト: yienit/KST
 private void LoadMsgBoxButtons(NuiBlueMessageBoxButtons msgBoxButtons)
 {
     switch (msgBoxButtons)
     {
         case NuiBlueMessageBoxButtons.OK:
             CreateOKButton();
             break;
         case NuiBlueMessageBoxButtons.OKCancel:
             CreateOKCancelButton();
             break;
         case NuiBlueMessageBoxButtons.RetryCancel:
             CreateRetryCancleButton();
             break;
         default:
             break;
     }
 }