///################################################################################# /// <summary> /// 显示按钮选择对话框,可自定义图 /// </summary> /// <param name="msg">要显示的文字</param> /// <param name="buttons">按钮种类</param> /// <param name="micon">图标种类</param> /// <returns>对话框返回值</returns> ///################################################################################# public static DialogResult Show(string msg, MessageBoxButtons buttons, MessageBoxIconEnum micon, bool bnewDialog) { if (bnewDialog) { frmMessage = new FrmMessageBox(); } frmMessage.ShowMessageBox(msg, buttons, micon); return(frmMessage.ShowDialog()); }
public static MessageBox Show(string text, string caption, MessageBoxButtonsEnum buttons, MessageBoxIconEnum icon) { return(Show(text, caption, buttons, icon, MessageBoxDefaultButtonEnum.Button1, null)); }
public static MessageBox Show(string text, string caption, MessageBoxButtonsEnum buttons, MessageBoxIconEnum icon, MessageBoxDefaultButtonEnum defaultButton, MessageBoxCallback callback) { var r = new MessageBox(); r.Centered = true; r.Caption = caption; r._buttons = buttons; r._icon = icon; r._defaultButton = defaultButton; r.Init(); r._label.Value = text; r._callback = callback; var root = (qxDotNet.UI.Container.Composite)Common.ApplicationState.Instance.GUI.GetRoot(); r._host = root; root.Add(r); r.Open(); return(r); }
///################################################################################# /// <summary> /// 显示按钮选择对话框,可自定义图 /// </summary> /// <param name="msg">要显示的文字</param> /// <param name="buttons">按钮种类</param> /// <param name="micon">图标种类</param> /// <returns>对话框返回值</returns> ///################################################################################# public static DialogResult Show(IWin32Window owner, string msg, MessageBoxButtons buttons, MessageBoxIconEnum micon) { frmMessage = new FrmMessageBox(); frmMessage.ShowMessageBox(msg, buttons, micon); return(frmMessage.ShowDialog(owner)); }
///################################################################################# /// <summary> /// 文字、各种按钮、图形 /// </summary> /// <param name="Message"></param> ///################################################################################# public void ShowMessageBox(string Text, MessageBoxButtons buttons, MessageBoxIconEnum icon) { //this.lbTitle.Text = "BizPatent Star"; this.Text = "IP Space"; this.lbNote.Text = Text; this.lbNote.Left = this.picNote.Left + picNote.Width + 10; this.lbNote.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; this.picNote.Visible = true; switch (icon) { case MessageBoxIconEnum.Error: { this.picNote.Image = this.picError.Image; break; } case MessageBoxIconEnum.Question: { this.picNote.Image = this.picQuestion.Image; break; } case MessageBoxIconEnum.Right: { this.picNote.Image = this.picRight.Image; break; } case MessageBoxIconEnum.Warning: { this.picNote.Image = this.picInfo.Image; break; } } switch (buttons) { case MessageBoxButtons.OK: { this.btnYes.Visible = false; this.btnNo.Visible = false; this.btnCancel.Visible = false; this.btnOK.Visible = true; this.btnOK.Left = (this.Width - btnOK.Width) / 2; break; } case MessageBoxButtons.YesNo: { this.btnYes.Visible = true; this.btnNo.Visible = true; this.btnCancel.Visible = false; this.btnOK.Visible = false; this.btnYes.Left = this.Width / 2 - btnYes.Width - 20; this.btnNo.Left = this.Width / 2 + 20; break; } case MessageBoxButtons.YesNoCancel: { this.btnYes.Visible = true; this.btnNo.Visible = true; this.btnCancel.Visible = true; this.btnOK.Visible = false; this.btnNo.Left = this.Width / 2 - btnNo.Width / 2; this.btnYes.Left = this.btnNo.Left - btnYes.Width - 20; this.btnCancel.Left = this.btnNo.Right + 20; break; } case MessageBoxButtons.OKCancel: { this.btnYes.Visible = false; this.btnNo.Visible = false; this.btnCancel.Visible = true; this.btnOK.Visible = true; this.btnOK.Left = this.Width / 2 - btnOK.Width - 20; this.btnCancel.Left = this.Width / 2 + 20; break; } case MessageBoxButtons.RetryCancel: { this.btnRetry.Visible = true; this.btnYes.Visible = false; this.btnNo.Visible = false; this.btnCancel.Visible = true; this.btnOK.Visible = false; this.btnRetry.Left = this.Width / 2 - btnRetry.Width - 20; this.btnCancel.Left = this.Width / 2 + 20; break; } } }