Esempio n. 1
0
 private void mnu_Click(object sender, System.EventArgs e)
 {
     if (sender == mnuNew)
     {
         frmChild f = new frmChild();
         f.MdiParent = this;
         f.Show();
     }
     else if (sender == mnuExit)
     {
         this.Close();
     }
 }
Esempio n. 2
0
        internal static void OnShowCreatedWebView(object sender, ShowCreatedWebViewEventArgs e)
        {
            IWebView view = sender as IWebView;

            if (null == view)
            {
                return;
            }
            if (!view.IsLive)
            {
                return;
            }

            frmMain mainForm = Application.OpenForms.OfType <frmMain>().FirstOrDefault();

            if (null == mainForm)
            {
                return;
            }

            if (e.IsPopup && !e.IsUserSpecsOnly)
            {
                Rectangle screenRect = e.Specs.InitialPosition.ToRectangle();
                frmChild  newWindow  = new frmChild(e.NewViewInstance)
                {
                    ShowInTaskbar = true,
                    ClientSize    = screenRect.Size != Size.Empty ? screenRect.Size : new Size(640, 480)
                };
                if (0 < screenRect.Width && 0 < screenRect.Height)
                {
                    newWindow.Width  = screenRect.Width;
                    newWindow.Height = screenRect.Height;
                }
                newWindow.Show();
                if (Point.Empty != screenRect.Location)
                {
                    newWindow.DesktopLocation = screenRect.Location;
                }
            }
            else if (e.IsWindowOpen || e.IsPost)
            {
                frmChild doc = new frmChild(e.NewViewInstance);
            }
            else
            {
                e.Cancel = true;
                frmChild doc = new frmChild(e.TargetURL);
            }
        }
Esempio n. 3
0
        private void OpenFormChild <frmChild>() where frmChild : Form, new()
        {
            Form childForm;

            childForm = pnlShowChild.Controls.OfType <frmChild>().FirstOrDefault();

            if (childForm == null)
            {
                childForm          = new frmChild();
                childForm.TopLevel = false;
                pnlShowChild.Controls.Add(childForm);
                pnlShowChild.Tag = childForm;
                childForm.Show();
                childForm.BringToFront();
            }
            else
            {
                childForm.BringToFront();
            }
        }
Esempio n. 4
0
        private void mfrmMDIClientPaint_Load(object sender, System.EventArgs e)
        {
            // Start processing for MDIClient window messages:
            mdiClient = new MDIClientWindow(this, this.Handle);
            // Stop the default window proc from drawing the MDI background
            // with the brush:
            UnManagedMethods.SetClassLong(
                mdiClient.Handle,
                UnManagedMethods.GCL_HBRBACKGROUND,
                0);

            // Load a sample child form:
            frmChild f = new frmChild();

            f.MdiParent = this;
            f.Show();

            // Attach to menu events:
            this.mnuNew.Click  += new System.EventHandler(this.mnu_Click);
            this.mnuExit.Click += new System.EventHandler(this.mnu_Click);
        }