Beispiel #1
0
        private static void InitIcon(MsgBoxIcon icon)
        {
            switch (icon)
            {
            case MsgBoxIcon.Application:
                _msgBox._picIcon.Image = SystemIcons.Application.ToBitmap();
                break;

            case MsgBoxIcon.Exclamation:
                _msgBox._picIcon.Image = SystemIcons.Exclamation.ToBitmap();
                break;

            case MsgBoxIcon.Error:
                _msgBox._picIcon.Image = SystemIcons.Error.ToBitmap();
                break;

            case MsgBoxIcon.Info:
                _msgBox._picIcon.Image = SystemIcons.Information.ToBitmap();
                break;

            case MsgBoxIcon.Question:
                _msgBox._picIcon.Image = SystemIcons.Question.ToBitmap();
                break;

            case MsgBoxIcon.Shield:
                _msgBox._picIcon.Image = SystemIcons.Shield.ToBitmap();
                break;

            case MsgBoxIcon.Warning:
                _msgBox._picIcon.Image = SystemIcons.Warning.ToBitmap();
                break;
            }
        }
Beispiel #2
0
        public static MsgBoxResult ShowDialog(this Control parentControl, string text,
                                              MsgBoxIcon icon, string caption, DefaultButton defaultBtn, params string[] buttonTxt)
        {
            using (var frm = new MsgBoxForm())
            {
                frm.Init(text, icon, caption, defaultBtn, buttonTxt);
                var parentForm = parentControl?.SelfOrParentForm();

                if (parentForm == null)
                {
                    frm.StartPosition = FormStartPosition.CenterScreen;
                    frm.ShowInTaskbar = true;
                    frm.TopMost       = true;
                    frm.ShowDialog();
                }
                else if (!parentForm.Visible ||
                         parentForm.WindowState == FormWindowState.Minimized)
                {
                    // The a form is not shown (e.g. minimized) , the Location and Size
                    // cannot be trusted. Location can sometimes be a negative number.
                    // Use CenterScreen is better than CenterParent, which can cause
                    // frm to show on top left corner.
                    frm.StartPosition = FormStartPosition.CenterScreen;
                    frm.ShowDialog();
                }
                else
                {
                    frm.ShowDialog(parentForm);
                }

                return(frm.SelectionResult);
            }
        }
Beispiel #3
0
        //
        public MsgBox(string message, string title = null, object additionalContent = null, string message2 = null,
                             MsgBoxIcon mbi = MsgBoxIcon.None)
        {
            InitializeComponent();

            // setup up dialog fields
            if (title == null)
                tb_title.Visibility = Visibility.Collapsed;
            else
            {
                tb_title.Visibility = Visibility.Visible;
                tb_title.Background = new SolidColorBrush(cl_Neutral);
                tb_title.Text = title;
            }

            tb_msg.Visibility = Visibility.Collapsed;
            if (message != null)
            {
                tb_msg.Visibility = Visibility.Visible;
                tb_msg.Text = message;
            }

            i_icon.Visibility = Visibility.Visible;
            switch (mbi)
            {
                case MsgBoxIcon.None:
                    i_icon.Visibility = Visibility.Collapsed;
                    break;
                case MsgBoxIcon.Question:
                    i_icon.Source = new BitmapImage(new Uri(@"Images/question.jpg", UriKind.Relative));
                    tb_title.Background = new SolidColorBrush(cl_Info);
                    break;
                case MsgBoxIcon.Info:
                    i_icon.Source = new BitmapImage(new Uri(@"Images/info.png", UriKind.Relative));
                    tb_title.Background = new SolidColorBrush(cl_Info);
                    break;
                case MsgBoxIcon.Warning:
                    i_icon.Source = new BitmapImage(new Uri(@"Images/warning.jpg", UriKind.Relative));
                    tb_title.Background = new SolidColorBrush(cl_Warning);
                    break;
                case MsgBoxIcon.Error:
                    i_icon.Source = new BitmapImage(new Uri(@"Images/error.png", UriKind.Relative));
                    tb_title.Background = new SolidColorBrush(cl_Error);
                    break;
            }

            cc_msg.Visibility = Visibility.Collapsed;
            if (cc_msg != null)
            {
                cc_msg.Visibility = Visibility.Visible;
                cc_msg.Content = additionalContent;
            }

            tb_msg2.Visibility = Visibility.Collapsed;
            if (message2 != null)
            {
                tb_msg2.Visibility = Visibility.Visible;
                tb_msg2.Text = message2;
            }
        }
Beispiel #4
0
        private void button2_Click(object sender, EventArgs e)
        {
            if (txtValue.Text.Length > 2000 || txtTitle.Text.Length > 256)
            {
                MessageBox.Show("内容太长!", "提示", 0, MessageBoxIcon.Error);
                return;
            }
            if (m_errorRadio.Checked == true)
            {
                MsgBoxIcon = MsgBoxIcon.Error;
            }
            else if (m_questionRadio.Checked == true)
            {
                MsgBoxIcon = MsgBoxIcon.Question;
            }
            else if (m_infoRadio.Checked == true)
            {
                MsgBoxIcon = MsgBoxIcon.InforMation;
            }
            else if (m_exclaRadio.Checked == true)
            {
                MsgBoxIcon = MsgBoxIcon.Exclaim;
            }

            this.MessageBody  = txtTitle.Text;
            this.MessageTitle = txtValue.Text;

            DialogResult = System.Windows.Forms.DialogResult.OK;
            this.Close();
        }
Beispiel #5
0
        private static void ShowMessage(string message, MsgBoxIcon icon)
        {
            MessageBoxIcon MessageBoxIcon = MessageBoxIcon.Information;

            if (icon == MsgBoxIcon.CRITICAL)
            {
                MessageBoxIcon = MessageBoxIcon.Error;
            }
            MessageBox.Show(message, "Plugin Config Loader", MessageBoxButtons.OK, MessageBoxIcon);
            return;
        }
Beispiel #6
0
        public MessageBox(string Title, string Message, MsgBoxButtons Buttons, MsgBoxIcon Icon, DialogClose oCallback)
        {
            InitializeComponent();

            ModalHost  = new ModalControl();
            _oCallback = oCallback;

            btOne.Click   += OneClick;
            btTwo.Click   += OneClick;
            btCross.Click += OneClick;

            //if (string.IsNullOrEmpty(Title))
            //    txtTitle.Text = "Error";
            //  else
            txtTitle.Text = Title;

            txtMessage.Text = Message;

            if (Buttons == MsgBoxButtons.YesNo)
            {
                btOne.Content = "Yes";
                btOne.Tag     = DialogExit.OK;

                btTwo.Content = "No";
                btTwo.Tag     = DialogExit.Cancel;
            }
            else
            {
                btOne.Visibility = Visibility.Collapsed;
                btTwo.Content    = "OK";
                btTwo.Tag        = DialogExit.Cancel;
            }

            btCross.Tag = DialogExit.Cancel;

            _lblIcon.Text = Icon.ToString();


            //string sImagePath = @"Resources\error_img.png";

            //if (Icon == MsgBoxIcon.Warning)
            //    sImagePath = "/images/warning.png";
            //else if (Icon == MsgBoxIcon.Error)
            //    sImagePath = "/images/error.png";

            //BitmapImage oImage = new BitmapImage();
            //oImage.UriSource = new Uri(sImagePath);
            ////oImage.SetSource(Application.GetResourceStream(new Uri(sImagePath)).Stream);
            //_imgIcon.Source = oImage;
        }
Beispiel #7
0
        private Image GetImage(MsgBoxIcon icon)
        {
            Image[] img =
            {
                Properties.Resources.infoIcon,
                Properties.Resources.YellowLight,
                Properties.Resources.RedLight
            };

            var height = picBox.Size.Height - 3;
            // We know that height == width.
            var size = new Size(height, height);

            return(ImageUtil.Resize(img[(int)icon], size));
        }
Beispiel #8
0
        public void Init(string text, MsgBoxIcon icon, string caption,
                         DefaultButton btn, params string[] buttonTxt)
        {
            var len = buttonTxt.Length;

            Ensure <ArgumentException>(len > (int)btn);

            SetLabelText(text);
            picBox.Image  = GetImage(icon);
            Text          = caption;
            activeButtons = new[] { button1, button2, button3 }.Take(len).ToList();

            ArrangeLayout(len);
            SetButtonText(buttonTxt, btn);
            SubscribeEvents();
        }
Beispiel #9
0
        public static MessageBoxImage GetIcon4Message(MsgBoxIcon icon)
        {
            switch (icon)
            {
            case MsgBoxIcon.Error:
                return(MessageBoxImage.Error);

            case MsgBoxIcon.Question:
                return(MessageBoxImage.Question);

            case MsgBoxIcon.Warning:
                return(MessageBoxImage.Warning);

            case MsgBoxIcon.Information:
                return(MessageBoxImage.Information);

            default:
                return(MessageBoxImage.None);
            }
        }
Beispiel #10
0
        // Token: 0x060000BD RID: 189 RVA: 0x00004FB4 File Offset: 0x000031B4
        internal void SetIcon(MsgBoxIcon icon)
        {
            switch (icon)
            {
            case MsgBoxIcon.Error:
                this.messageImageBox.Image = this.customMessageBoxImageList.Images["SetupError.png"];
                this.captureLabel.Text     = this.captureTexts[MsgBoxIcon.Error];
                return;

            case MsgBoxIcon.Warning:
                this.messageImageBox.Image = this.customMessageBoxImageList.Images["SetupWarning.png"];
                this.captureLabel.Text     = this.captureTexts[MsgBoxIcon.Warning];
                return;

            case MsgBoxIcon.Cancel:
                this.messageImageBox.Image = this.customMessageBoxImageList.Images["SetupWarning.png"];
                this.captureLabel.Text     = this.captureTexts[MsgBoxIcon.Cancel];
                return;
            }
            this.messageImageBox.Image   = null;
            this.messageImageBox.Visible = false;
        }
Beispiel #11
0
        public static MsgBoxResult ShowDialog(this Control parentControl, string text,
                                              MsgBoxIcon icon, string caption, DefaultButton defaultBtn, params string[] buttonTxt)
        {
            using (var frm = new MsgBoxForm())
            {
                frm.Init(text, icon, caption, defaultBtn, buttonTxt);
                var parentForm = parentControl?.SelfOrParentForm();

                if (parentForm == null)
                {
                    frm.StartPosition = FormStartPosition.CenterScreen;
                    frm.ShowInTaskbar = true;
                    frm.TopMost       = true;
                    frm.ShowDialog();
                }
                else
                {
                    frm.ShowDialog(parentForm);
                }

                return(frm.SelectionResult);
            }
        }
Beispiel #12
0
 internal MsgBoxExForm(string message, string caption, MsgBoxButtons msgBoxButtons, MsgBoxIcon icon, MsgBoxDefaultButton defaultButton,
                       MsgBoxCheckBox checkBox, string textColor) : this(message, caption, msgBoxButtons, icon, defaultButton, checkBox)
 {
     // Set the color of the Message text.
     TextColor = textColor;
 }
Beispiel #13
0
 /// <summary>
 /// Displays a message box with specified text, caption, buttons and Icon.
 /// </summary>
 /// <param name="message">
 /// The text to display in the message box.
 /// </param>
 /// <param name="caption">
 /// The text to display in the title bar of the message box.
 /// </param>
 /// <param name="msgBoxButtons">
 /// One of the MsgBoxButtons values that specifies which
 /// buttons to display.
 /// </param>
 /// <param name="icon">
 /// One of the MsgBoxIcon values that specifies which icon
 /// to display in the message box.
 /// </param>
 /// <returns>
 /// One of the MsgBoxResult values.
 /// </returns>
 public static MsgBoxResult Show(string message, string caption, MsgBoxButtons msgBoxButtons, MsgBoxIcon icon)
 {
     return(new MsgBoxExForm(message, caption, msgBoxButtons, icon).Show());
 }
Beispiel #14
0
 public MsgBoxResult MessageBox(string text, string caption = null, MsgBoxButtons buttons = 0, MsgBoxIcon icon = 0, MsgBoxFlags flags = 0)
 {
     return(msgBox.Show(text, caption ?? App.AppName, buttons, icon, flags));
 }
Beispiel #15
0
 /// <summary>
 /// Displays a message box with specified text, caption, buttons, Icon, default button and a Do not show again Check box.
 /// To get the result of the check box, add: Syste.Windows.Forms.CheckState doNotShowAgain = System.Windows.Forms.CheckState.Indeterminate;
 /// Before the MsgBox call.
 /// </summary>
 /// <param name="message">
 /// The text to display in the message box.
 /// </param>
 /// <param name="caption">
 /// The text to display in the title bar of the message box.
 /// </param>
 /// <param name="msgBoxButtons">
 /// One of the MsgBoxButtons values that specifies which
 /// buttons to display.
 /// </param>
 /// <param name="icon">
 /// One of the MsgBoxIcon values that specifies which icon
 /// to display in the message box.
 /// <param name="defaultButton">
 ///  One of the MsgBoxDefaultButton values that specifies
 ///  the default button for the message box.
 /// </param>
 /// <param name="doNotShowAgain">
 /// Show (checked) or hide the Do not show again check box.
 /// </param>
 /// <param name="checkBoxState">
 /// The checked state of the Do not show again check box.
 /// </param>
 /// <returns>
 /// One of the MsgBoxResult values.
 /// The state of the Do not show again check box.
 /// </returns>
 public static MsgBoxResult Show(string message, string caption, MsgBoxButtons msgBoxButtons, MsgBoxIcon icon, MsgBoxDefaultButton defaultButton,
                                 MsgBoxCheckBox doNotShowAgain, out CheckState checkBoxState)
 {
     return(new MsgBoxExForm(message, caption, msgBoxButtons, icon, defaultButton, doNotShowAgain).Show(out checkBoxState));
 }
Beispiel #16
0
 /// <summary>
 /// Displays a message box with specified text, caption, buttons, Icon, default button, a Do not show again Check box,
 /// custom Text color using a hexadecimal color (web color code #0000FF = Blue text), custom form background color
 /// using a hexadecimal color (web color code #C0C0C0 = Silver background) (The button bar is automatic set to a darker color than the form background.)
 /// and MsgBox order (TopMost).
 /// To get the result of the check box, add: Syste.Windows.Forms.CheckState doNotShowAgain = System.Windows.Forms.CheckState.Indeterminate;
 /// Before the MsgBox call.
 /// </summary>
 /// <param name="message">
 /// The text to display in the message box.
 /// </param>
 /// <param name="caption">
 /// The text to display in the title bar of the message box.
 /// </param>
 /// <param name="msgBoxButtons">
 /// One of the MsgBoxButtons values that specifies which
 /// buttons to display.
 /// </param>
 /// <param name="icon">
 /// One of the MsgBoxIcon values that specifies which icon
 /// to display in the message box.
 /// <param name="defaultButton">
 ///  One of the MsgBoxDefaultButton values that specifies
 ///  the default button for the message box.
 /// </param>
 /// <param name="doNotShowAgain">
 /// Show (checked) or hide the Do not show again check box.
 /// </param>
 /// <param name="checkBoxState">
 /// The checked state of the Do not show again check box.
 /// </param>
 /// <param name="textColor">
 /// A hexadecimal color code (web color code #FF0000 = Red)
 /// </param>
 /// <param name="formColor">
 /// A hexadecimal color code (web color code #FFFFFF = White)
 /// </param>
 /// <param name="topMost">
 /// State of the message box Z index (TopMost)
 /// </param>
 /// <returns>
 /// One of the MsgBoxResult values.
 /// The state of the Do not show again check box.
 /// </returns>
 public static MsgBoxResult Show(string message, string caption, MsgBoxButtons msgBoxButtons, MsgBoxIcon icon, MsgBoxDefaultButton defaultButton,
                                 MsgBoxCheckBox doNotShowAgain, out CheckState checkBoxState, string textColor, string formColor, MsgBoxOrder topMost)
 {
     return(new MsgBoxExForm(message, caption, msgBoxButtons, icon, defaultButton, doNotShowAgain, textColor, formColor, topMost).Show(out checkBoxState));
 }
Beispiel #17
0
 /// <summary>
 /// Displays a message box with specified text.
 /// </summary>
 /// <param name="icon">One of the MessageBoxIcon values that specifies which
 /// icon to display in the message box.</param>
 /// <param name="caption">The text to display in the title bar of the message box.</param>
 /// <param name="text">The text to display in the title bar of the message box.</param>
 public static void Show(MsgBoxIcon icon, string caption, string text)
 {
     MessageBox.Show(text, caption, MessageBoxButtons.OK, (MessageBoxIcon)icon);
 }
Beispiel #18
0
        public static DialogResult Show(IWin32Window owner, string message, string title, MsgBoxButtons buttons, MsgBoxIcon icon)
        {
            _msgBox = new MsgBox();
            _msgBox._lblMessage.Text = message;
            _msgBox.Text             = title;

            InitButtons(buttons);
            InitIcon(icon);

            _msgBox.Size = MessageSize(message);
            ShowMsgBox(owner);
            return(_buttonResult);
        }
Beispiel #19
0
 private static void ShowMessage(string message, MsgBoxIcon icon)
 {
     MessageBoxIcon MessageBoxIcon = MessageBoxIcon.Information;
     if (icon == MsgBoxIcon.CRITICAL) MessageBoxIcon = MessageBoxIcon.Error;
     MessageBox.Show(message, "Plugin Config Loader", MessageBoxButtons.OK, MessageBoxIcon);
     return;
 }
Beispiel #20
0
 /// <summary>
 /// Displays a message box with specified text.
 /// </summary>
 /// <param name="icon">One of the MessageBoxIcon values that specifies which
 /// icon to display in the message box.</param>
 /// <param name="caption">The text to display in the title bar of the message box.</param>
 /// <param name="text">The text to display in the title bar of the message box.</param>
 public static void Show(MsgBoxIcon icon, string caption, string text)
 {
     MessageBox.Show(text, caption, MessageBoxButtons.OK, (MessageBoxIcon)icon);
 }
Beispiel #21
0
 /// <summary>
 /// Displays a message box with specified text.
 /// </summary>
 /// <param name="icon">One of the MessageBoxIcon values that specifies which
 /// icon to display in the message box.</param>
 /// <param name="caption">The text to display in the title bar of the message box.</param>
 /// <param name="format">The formated text to display in the message box.</param>
 /// <param name="args">An array of objects to display using format.</param>
 public static void Show(MsgBoxIcon icon, string caption, string format, params object[] args)
 {
     MessageBox.Show(string.Format(format, args), caption, MessageBoxButtons.OK, (MessageBoxIcon)icon);
 }
Beispiel #22
0
 internal MsgBoxExForm(string message, string caption, MsgBoxButtons msgBoxButtons, MsgBoxIcon icon, MsgBoxDefaultButton defaultButton) :
     this(message, caption, msgBoxButtons, icon)
 {
     // Set default button
     DefaultButton = defaultButton;
 }
Beispiel #23
0
 public static MsgBoxResult Show(IntPtr hWnd, string text, string caption = null, MsgBoxButtons buttons = 0, MsgBoxIcon icon = 0, MsgBoxFlags flags = 0)
 {
     return((MsgBoxResult)MessageBox(hWnd, text, caption, (MB)buttons | (MB)icon | (MB)flags));
 }
Beispiel #24
0
        public MsgBoxResult Show(string text, string caption = null, MsgBoxButtons buttons = 0, MsgBoxIcon icon = 0, MsgBoxFlags flags = 0)
        {
            if (hWnd != IntPtr.Zero && CenterOwner)
            {
                IntPtr hInst = GetWindowLong(hWnd, GWL.HINSTANCE);
                IntPtr thrId = GetCurrentThreadId();
                hook = SetWindowsHookEx(WH.CBT, HookPrc, hInst, thrId);
            }

            return((MsgBoxResult)MessageBox(hWnd, text, caption, (MB)buttons | (MB)icon | (MB)flags));
        }
Beispiel #25
0
        public frmMsgBox(string message, string title = "", MessageBoxButtons buttons = MessageBoxButtons.OK, MsgBoxIcon icon = MsgBoxIcon.None) : this()
        {
            txtMessage.Text = message;
            lblTitle.Text   = title;
            this.buttons    = buttons;
            if (this.buttons == MessageBoxButtons.YesNo)
            {
                btnNo.Visible = true;
                btnOK.Text    = "بله";
            }//if

            switch (icon)
            {
            case MsgBoxIcon.Error:
                picIcon.Image = imageList1.Images[0];
                break;

            case MsgBoxIcon.Success:
                picIcon.Image = imageList1.Images[1];
                break;

            case MsgBoxIcon.Question:
                picIcon.Image = imageList1.Images[2];
                break;

            case MsgBoxIcon.Stop:
                picIcon.Image = imageList1.Images[3];
                break;

            default:
                break;
            }//switch
        }
Beispiel #26
0
 internal MsgBoxExForm(string message, string caption, MsgBoxButtons msgBoxButtons, MsgBoxIcon icon, MsgBoxDefaultButton defaultButton,
                       MsgBoxCheckBox checkBox, string textColor, string formBackGroundColor, MsgBoxOrder topmost) :
     this(message, caption, msgBoxButtons, icon, defaultButton, checkBox, textColor, formBackGroundColor)
 {
     // Set the Z index of the form.
     SetTopMost = topmost;
 }
Beispiel #27
0
        public static MsgBoxDialogResult Show(string text, string caption, MsgBoxButtons buttons, MsgBoxIcon icon)
        {
            DialogForm dialogForm = new DialogForm(text, caption, buttons);

            dialogForm.ShowDialog();
            return(result);
        }
Beispiel #28
0
 internal MsgBoxExForm(string message, string caption, MsgBoxButtons msgBoxButtons, MsgBoxIcon icon) : this(message, caption, msgBoxButtons)
 {
     // Set the icon style.
     IconStyle = icon;
 }
Beispiel #29
0
 /// <summary>
 /// Displays a message box with specified text.
 /// </summary>
 /// <param name="icon">One of the MessageBoxIcon values that specifies which
 /// icon to display in the message box.</param>
 /// <param name="text">The text to display in the title bar of the message box.</param>
 public static void Show(MsgBoxIcon icon, string text)
 {
     MessageBox.Show(text);
 }
Beispiel #30
0
 internal MsgBoxExForm(string message, string caption, MsgBoxButtons msgBoxButtons, MsgBoxIcon icon,
                       MsgBoxDefaultButton defaultButton, MsgBoxCheckBox checkBox) : this(message, caption, msgBoxButtons, icon, defaultButton)
 {
     // Set the check box
     CheckBox = checkBox;
 }
Beispiel #31
0
        public DlgResult ShowMessage(string message, string caption, MsgBoxButton buttons, MsgBoxIcon image)
        {
            var dialogResult = default(DlgResult);

            if (!Dispatcher.CheckAccess())
            {
                Dispatcher.Invoke(() =>
                {
                    dialogResult = ShowMessage(message, caption, buttons, image);
                });
            }
            else
            {
                var window      = GetActiveWindow();
                var buttons4Box = EnumHelper.GetButtons4Message(buttons);
                var icon        = EnumHelper.GetIcon4Message(image);

                var result = MessageBox.Show(null, message, caption, buttons4Box, icon);
                dialogResult = EnumHelper.GetDialogResult(result);
            }

            return(dialogResult);
        }
Beispiel #32
0
 internal MsgBoxExForm(string message, string caption, MsgBoxButtons msgBoxButtons, MsgBoxIcon icon, MsgBoxDefaultButton defaultButton,
                       MsgBoxCheckBox checkBox, string textColor, string formBackGroundColor) :
     this(message, caption, msgBoxButtons, icon, defaultButton, checkBox, textColor)
 {
     // Set the color of the form background.
     FormColor = formBackGroundColor;
 }
Beispiel #33
0
 /// <summary>
 /// Displays a message box with specified text.
 /// </summary>
 /// <param name="icon">One of the MessageBoxIcon values that specifies which
 /// icon to display in the message box.</param>
 /// <param name="caption">The text to display in the title bar of the message box.</param>
 /// <param name="format">The formated text to display in the message box.</param>
 /// <param name="args">An array of objects to display using format.</param>
 public static void Show(MsgBoxIcon icon, string caption, string format, params object[] args)
 {
     MessageBox.Show(string.Format(format, args), caption, MessageBoxButtons.OK, (MessageBoxIcon)icon);
 }
        // Token: 0x06000181 RID: 385 RVA: 0x00008930 File Offset: 0x00006B30
        public static DialogResult Show(IWin32Window owner, string text, MessageBoxButtons buttons, MsgBoxIcon icon)
        {
            DialogResult result;

            using (CustomMessageBox customMessageBox = new CustomMessageBox(MessageBoxHelper.buttonTexts, MessageBoxHelper.captureTexts))
            {
                customMessageBox.Owner = (Form)owner;
                if (customMessageBox.Owner == null)
                {
                    customMessageBox.StartPosition = FormStartPosition.CenterScreen;
                }
                else
                {
                    customMessageBox.StartPosition = FormStartPosition.CenterParent;
                }
                customMessageBox.MessageIcon = icon;
                customMessageBox.Buttons     = buttons;
                customMessageBox.MessageText = text;
                customMessageBox.TopMost     = true;
                customMessageBox.BringToFront();
                result = customMessageBox.ShowDialog();
                customMessageBox.TopMost = false;
            }
            return(result);
        }
Beispiel #35
0
 /// <summary>
 /// Displays a message box with specified text.
 /// </summary>
 /// <param name="icon">One of the MessageBoxIcon values that specifies which
 /// icon to display in the message box.</param>
 /// <param name="text">The text to display in the title bar of the message box.</param>
 public static void Show(MsgBoxIcon icon, string text)
 {
     MessageBox.Show(text);
 }