コード例 #1
0
        public static DialogResult Show(string message, string caption, MessageAlertButtons button, MessageAlertIcons icon)
        {
            MessageAlert m = new MessageAlert();

            m.lblMessage.Text = message;
            m.Text            = caption;
            m.setIconImage(icon);

            switch (button)
            {
            case MessageAlertButtons.OK:
                m.btnOK.SetBounds(m.panelBtn.ClientSize.Width - (10 + m.btnOK.Width), Convert.ToInt32((m.panelBtn.ClientSize.Height - m.btnOK.Height) / 2), m.btnOK.Width, m.btnOK.Height);
                m.btnOK.Visible = true;
                break;

            case MessageAlertButtons.OK_CANCEL:
                m.btnCancel.SetBounds(m.panelBtn.ClientSize.Width - (10 + m.btnCancel.Width), Convert.ToInt32((m.panelBtn.ClientSize.Height - m.btnCancel.Height) / 2), m.btnCancel.Width, m.btnCancel.Height);
                m.btnOK.SetBounds(m.panelBtn.ClientSize.Width - (10 + m.btnCancel.Width + 10 + m.btnOK.Width), Convert.ToInt32((m.panelBtn.ClientSize.Height - m.btnOK.Height) / 2), m.btnOK.Width, m.btnOK.Height);
                m.btnOK.Visible     = true;
                m.btnCancel.Visible = true;
                m.btnCancel.Focus();
                break;

            case MessageAlertButtons.YES:
                m.btnYes.SetBounds(m.panelBtn.ClientSize.Width - (10 + m.btnYes.Width), Convert.ToInt32((m.panelBtn.ClientSize.Height - m.btnYes.Height) / 2), m.btnYes.Width, m.btnYes.Height);
                m.btnYes.Visible = true;
                break;

            case MessageAlertButtons.YES_NO:
                m.btnNo.SetBounds(m.panelBtn.ClientSize.Width - (10 + m.btnNo.Width), Convert.ToInt32((m.panelBtn.ClientSize.Height - m.btnNo.Height) / 2), m.btnNo.Width, m.btnNo.Height);
                m.btnYes.SetBounds(m.panelBtn.ClientSize.Width - (10 + m.btnNo.Width + 10 + m.btnYes.Width), Convert.ToInt32((m.panelBtn.ClientSize.Height - m.btnYes.Height) / 2), m.btnYes.Width, m.btnYes.Height);
                m.btnYes.Visible = true;
                m.btnNo.Visible  = true;
                break;

            case MessageAlertButtons.RETRY_CANCEL:
                m.btnCancel.SetBounds(m.panelBtn.ClientSize.Width - (10 + m.btnCancel.Width), Convert.ToInt32((m.panelBtn.ClientSize.Height - m.btnCancel.Height) / 2), m.btnCancel.Width, m.btnCancel.Height);
                m.btnRetry.SetBounds(m.panelBtn.ClientSize.Width - (10 + m.btnCancel.Width + 10 + m.btnRetry.Width), Convert.ToInt32((m.panelBtn.ClientSize.Height - m.btnRetry.Height) / 2), m.btnRetry.Width, m.btnRetry.Height);
                m.btnRetry.Visible  = true;
                m.btnCancel.Visible = true;
                m.btnCancel.Focus();
                break;

            default:
                break;
            }
            return(m.ShowDialog());
        }
コード例 #2
0
ファイル: MessageAlert.cs プロジェクト: wee2tee/SN_Net
        public static DialogResult Show(string message, string caption, MessageAlertButtons button, MessageAlertIcons icon)
        {
            MessageAlert m = new MessageAlert();
            m.lblMessage.Text = message;
            m.Text = caption;
            m.setIconImage(icon);

            switch (button)
            {
                case MessageAlertButtons.OK:
                    m.btnOK.SetBounds(m.panelBtn.ClientSize.Width - (10 + m.btnOK.Width), Convert.ToInt32((m.panelBtn.ClientSize.Height - m.btnOK.Height) / 2), m.btnOK.Width, m.btnOK.Height);
                    m.btnOK.Visible = true;
                    break;
                case MessageAlertButtons.OK_CANCEL:
                    m.btnCancel.SetBounds(m.panelBtn.ClientSize.Width - (10 + m.btnCancel.Width), Convert.ToInt32((m.panelBtn.ClientSize.Height - m.btnCancel.Height) / 2), m.btnCancel.Width, m.btnCancel.Height);
                    m.btnOK.SetBounds(m.panelBtn.ClientSize.Width - (10 + m.btnCancel.Width + 10 + m.btnOK.Width), Convert.ToInt32((m.panelBtn.ClientSize.Height - m.btnOK.Height) / 2), m.btnOK.Width, m.btnOK.Height);
                    m.btnOK.Visible = true;
                    m.btnCancel.Visible = true;
                    m.btnCancel.Focus();
                    break;
                case MessageAlertButtons.YES:
                    m.btnYes.SetBounds(m.panelBtn.ClientSize.Width - (10 + m.btnYes.Width), Convert.ToInt32((m.panelBtn.ClientSize.Height - m.btnYes.Height) / 2), m.btnYes.Width, m.btnYes.Height);
                    m.btnYes.Visible = true;
                    break;
                case MessageAlertButtons.YES_NO:
                    m.btnNo.SetBounds(m.panelBtn.ClientSize.Width - (10 + m.btnNo.Width), Convert.ToInt32((m.panelBtn.ClientSize.Height - m.btnNo.Height) / 2), m.btnNo.Width, m.btnNo.Height);
                    m.btnYes.SetBounds(m.panelBtn.ClientSize.Width - (10 + m.btnNo.Width + 10 + m.btnYes.Width), Convert.ToInt32((m.panelBtn.ClientSize.Height - m.btnYes.Height) / 2), m.btnYes.Width, m.btnYes.Height);
                    m.btnYes.Visible = true;
                    m.btnNo.Visible = true;
                    break;
                case MessageAlertButtons.RETRY_CANCEL:
                    m.btnCancel.SetBounds(m.panelBtn.ClientSize.Width - (10 + m.btnCancel.Width), Convert.ToInt32((m.panelBtn.ClientSize.Height - m.btnCancel.Height) / 2), m.btnCancel.Width, m.btnCancel.Height);
                    m.btnRetry.SetBounds(m.panelBtn.ClientSize.Width - (10 + m.btnCancel.Width + 10 + m.btnRetry.Width), Convert.ToInt32((m.panelBtn.ClientSize.Height - m.btnRetry.Height) / 2), m.btnRetry.Width, m.btnRetry.Height);
                    m.btnRetry.Visible = true;
                    m.btnCancel.Visible = true;
                    m.btnCancel.Focus();
                    break;
                default:
                    break;
            }
            return m.ShowDialog();
        }