示例#1
0
        public static DialogResult Show(Control parent, string message)
        {
            _msgBox                  = new MessageBox();
            _msgBox.Parent           = parent;
            _msgBox._lblMessage.Text = message;
            _msgBox.Size             = _msgBox.MessageSize(message);

            MessageBox.InitButtons(Buttons.OK);

            _msgBox.ShowDialog();

            return(_buttonResult);
        }
示例#2
0
        public static DialogResult Show(string message, string title = "")
        {
            _msgBox = new MessageBox();
            _msgBox._lblMessage.Text = message;
            _msgBox.Text             = title;
            _msgBox.Size             = _msgBox.MessageSize(message);

            MessageBox.InitButtons(Buttons.OK);

            _msgBox.ShowDialog();

            return(_buttonResult);
        }
示例#3
0
        public static DialogResult Show(Control parent, string message, string title, Buttons buttons, Icon icon)
        {
            _msgBox                  = new MessageBox();
            _msgBox.Parent           = parent;
            _msgBox._lblMessage.Text = message;
            _msgBox.Text             = title;

            MessageBox.InitButtons(buttons);
            MessageBox.InitIcon(icon);

            _msgBox.Size = _msgBox.MessageSize(message);
            _msgBox.ShowDialog();

            return(_buttonResult);
        }
示例#4
0
        public static DialogResult Show(Control parent, string message, string title, FormClosedEventDelegate formClosed)
        {
            _msgBox                  = new MessageBox();
            _msgBox.Parent           = parent;
            _msgBox._lblMessage.Text = message;
            _msgBox.Text             = title;
            _msgBox.Size             = _msgBox.MessageSize(message);
            _msgBox.FormClosed      += (s, ex) =>
            {
                formClosed.Invoke(s, ex);
            };

            MessageBox.InitButtons(Buttons.OK);

            _msgBox.ShowDialog();

            return(_buttonResult);
        }
示例#5
0
        public static DialogResult Show(Control parent, string message, string title, Buttons buttons, Icon icon, AnimateStyle style)
        {
            _msgBox = new MessageBox();
            //_msgBox.Socket = parent.Socket;
            _msgBox._lblMessage.Text = message;
            _msgBox.Text             = title;
            _msgBox.Height           = 0;

            MessageBox.InitButtons(buttons);
            MessageBox.InitIcon(icon);

            _timer = new Timer();
            Size formSize = _msgBox.MessageSize(message);

            switch (style)
            {
            case MessageBox.AnimateStyle.SlideDown:
                _msgBox.Size    = new Size(formSize.Width, 0);
                _timer.Interval = 1;
                _timer.Tag      = new AnimateMsgBox(formSize, style);
                break;

            case MessageBox.AnimateStyle.FadeIn:
                _msgBox.Size    = formSize;
                _msgBox.Opacity = 0;
                _timer.Interval = 20;
                _timer.Tag      = new AnimateMsgBox(formSize, style);
                break;

            case MessageBox.AnimateStyle.ZoomIn:
                _msgBox.Size    = new Size(formSize.Width + 100, formSize.Height + 100);
                _timer.Tag      = new AnimateMsgBox(formSize, style);
                _timer.Interval = 1;
                break;
            }

            _timer.Tick += timer_Tick;
            _timer.Start();

            _msgBox.ShowDialog();

            return(_buttonResult);
        }