Пример #1
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="acaption"></param>
        /// <param name="text"></param>
        /// <param name="icon"></param>
        /// <returns></returns>
        public static DialogResult ShowDialog(string acaption, string text, MessageBoxIcon icon)
        {
            DialogResult res = DialogResult.Cancel;
            Form embeddedform = new Form();
            uctrlConfirmDlg confirmPanel = new uctrlConfirmDlg();
            try {
                prepareForm(embeddedform, confirmPanel, acaption, text, icon, false);
                res = embeddedform.ShowDialog();

            } finally {
                embeddedform.Dispose();
            }

            return res;
        }
Пример #2
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="acaption"></param>
        /// <param name="text"></param>
        /// <param name="icon"></param>
        /// <param name="checkboxset"></param>
        /// <returns></returns>
        public static DialogResult ShowDialog(string acaption, string text, MessageBoxIcon icon,
            ref bool checkboxset
            )
        {
            DialogResult res = DialogResult.OK;

            // Don't bother showing it if it's NOT set...
            if (checkboxset) {
                Form embeddedform = new Form();
                uctrlConfirmDlg confirmPanel = new uctrlConfirmDlg();
                try {
                    prepareForm(embeddedform, confirmPanel, acaption, text, icon, true);
                    res = embeddedform.ShowDialog();

                } finally {
                    checkboxset = !confirmPanel.ConfirmCheckBox.Checked;
                    embeddedform.Dispose();
                }
            }

            return res;
        }
Пример #3
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="aform"></param>
        private static void prepareForm(Form aform, uctrlConfirmDlg confirmPanel,
            string caption, string labeltext,
            MessageBoxIcon anicon, bool showcheckbox)
        {
            confirmPanel.Labeltext.Text = labeltext;
            aform.Text = caption;
            aform.Controls.Add(confirmPanel);
            aform.ClientSize = confirmPanel.ClientSize;
            aform.AcceptButton = confirmPanel.OKButton;
            aform.CancelButton = confirmPanel.CancelButton;
            aform.FormBorderStyle = FormBorderStyle.FixedDialog;
            aform.MaximizeBox = false;
            aform.MinimizeBox = false;
            aform.ShowIcon = false;
            aform.ControlBox = false;
            aform.ShowInTaskbar = false;
            aform.WindowState = FormWindowState.Normal;
            aform.StartPosition = FormStartPosition.CenterParent;

            if (!showcheckbox) {
                confirmPanel.ConfirmCheckBox.Visible = false;
                aform.Height -= (confirmPanel.ConfirmCheckBox.Height -
                    (aform.Height - aform.ClientSize.Height));
            }

            confirmPanel.Picture.Image = iconEnumerationToBitmap(anicon);
        }
Пример #4
0
        public static DialogResult ShowDialog(string acaption, string text, MessageBoxIcon icon,
            ref bool checkboxset, DialogType dlgtype
            )
        {
            DialogResult res = DialogResult.OK;

            // Don't bother showing it if it's NOT set...
            if (checkboxset) {
                Form embeddedform = new Form();
                uctrlConfirmDlg confirmPanel = new uctrlConfirmDlg();
                try {
                    prepareForm(embeddedform, confirmPanel, acaption, text, icon, true);

                    if (dlgtype == DialogType.YesNo) {
                        confirmPanel.OKButton.Text = "Yes";
                        confirmPanel.OKButton.DialogResult = DialogResult.Yes;
                        confirmPanel.CancelButton.Text = "No";
                        confirmPanel.CancelButton.DialogResult = DialogResult.No;
                    }
                    res = embeddedform.ShowDialog();

                } finally {
                    checkboxset = !confirmPanel.ConfirmCheckBox.Checked;
                    embeddedform.Dispose();
                }
            }

            return res;
        }