public static DialogResult ShowDialog(Form parent, Form dialog)
 {
     mask = new MaskedDialog(parent, dialog);
     dialog.StartPosition = FormStartPosition.CenterParent;
     mask.MdiParent = parent.MdiParent;
     mask.Show();
     DialogResult result = dialog.ShowDialog(mask);
     mask.Close();
     return result;
 }
        public static DialogResult ShowDialog(Form parent, UserControl dialog)
        {
            mask = new MaskedDialog(parent, dialog);
            frmContainer = new Form();
            frmContainer.ShowInTaskbar = false;
            frmContainer.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
            frmContainer.StartPosition = FormStartPosition.CenterParent;
            frmContainer.Height = dialog.Height;
            frmContainer.Width = dialog.Width;

            frmContainer.Controls.Add(dialog);
            mask.MdiParent = parent.MdiParent;
            mask.Show();
            DialogResult result = frmContainer.ShowDialog(mask);
            frmContainer.Close();
            mask.Close();
            return result;
        }