Пример #1
0
        public static DialogResult ShowDialog(Form parent, Form dialog)
        {
            //Enabled = false;
            Form shadow = new Form();

            shadow.MinimizeBox = false;
            shadow.MaximizeBox = false;
            shadow.ControlBox  = false;

            shadow.Text            = "";
            shadow.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
            //shadow.Size = Size;
            shadow.BackColor     = Color.Black;
            shadow.Opacity       = 0.3;
            shadow.ShowInTaskbar = false;
            shadow.WindowState   = FormWindowState.Maximized;
            shadow.Show();
            //shadow.Location = Location;
            shadow.Enabled = false;

            var mask = new frmOpacity(parent, dialog);

            dialog.StartPosition = FormStartPosition.CenterParent;
            //mask.Show();
            var result = dialog.ShowDialog(mask);

            mask.Close();
            shadow.Close();
            return(result);
        }
Пример #2
0
        public static DialogResult ShowDialog(Form parent, Form dialog)
        {
            //Enabled = false;
            Form shadow = new Form();
            shadow.MinimizeBox = false;
            shadow.MaximizeBox = false;
            shadow.ControlBox = false;

            shadow.Text = "";
            shadow.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
            //shadow.Size = Size;
            shadow.BackColor = Color.Black;
            shadow.Opacity = 0.3;
            shadow.ShowInTaskbar = false;
            shadow.WindowState = FormWindowState.Maximized;
            shadow.Show();
            //shadow.Location = Location;
            shadow.Enabled = false;

            var mask = new frmOpacity(parent, dialog);
            dialog.StartPosition = FormStartPosition.CenterParent;
            //mask.Show();
            var result = dialog.ShowDialog(mask);
            mask.Close();
            shadow.Close();
            return result;
        }