コード例 #1
0
        public static void SetMdiContainerBorderStyle(this System.Windows.Forms.Form mdiMainForm, System.Windows.Forms.BorderStyle borderStyle)
        {
            System.Windows.Forms.MdiClient mdiClient = GetMdiClient(mdiMainForm);
            if (mdiClient != null)
            {
                int style   = GetWindowLong(mdiClient.Handle, GWL_STYLE);
                int exStyle = GetWindowLong(mdiClient.Handle, GWL_EXSTYLE);
                if (borderStyle == System.Windows.Forms.BorderStyle.Fixed3D)
                {
                    style   = 1442906112;
                    exStyle = 512;
                }
                else if (borderStyle == System.Windows.Forms.BorderStyle.FixedSingle)
                {
                    style   |= WS_BORDER;
                    exStyle &= ~WS_EX_CLIENTEDGE;
                }
                else if (borderStyle == System.Windows.Forms.BorderStyle.None)
                {
                    style   &= ~WS_BORDER;
                    exStyle &= ~WS_EX_CLIENTEDGE;
                }
                SetWindowLong(mdiClient.Handle, GWL_STYLE, style);
                SetWindowLong(mdiClient.Handle, GWL_EXSTYLE, exStyle);

                int flags = SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_NOOWNERZORDER | SWP_FRAMECHANGED;
                SetWindowPos(mdiClient.Handle, IntPtr.Zero, 0, 0, 0, 0, flags);
            }
        }
コード例 #2
0
 public static void SetMdiContainerBackColor(this System.Windows.Forms.Form mdiMainForm, System.Drawing.Color backColor)
 {
     System.Windows.Forms.MdiClient mdiClient = GetMdiClient(mdiMainForm);
     if (mdiClient != null)
     {
         mdiClient.BackColor = backColor;
     }
 }
コード例 #3
0
 internal override void AfterControlRemoved(Control control, Control oldParent)
 {
     base.AfterControlRemoved(control, oldParent);
     if (control == this.AcceptButton)
     {
         this.AcceptButton = null;
     }
     if (control == this.CancelButton)
     {
         this.CancelButton = null;
     }
     if (control == this.ctlClient)
     {
         this.ctlClient = null;
         this.UpdateMenuHandles();
     }
 }
コード例 #4
0
 protected override void Dispose(bool disposing)
 {
     if (disposing)
     {
         this.CalledOnLoad = false;
         this.CalledMakeVisible = false;
         this.CalledCreateControl = false;
         if (base.Properties.ContainsObject(PropAcceptButton))
         {
             base.Properties.SetObject(PropAcceptButton, null);
         }
         if (base.Properties.ContainsObject(PropCancelButton))
         {
             base.Properties.SetObject(PropCancelButton, null);
         }
         if (base.Properties.ContainsObject(PropDefaultButton))
         {
             base.Properties.SetObject(PropDefaultButton, null);
         }
         if (base.Properties.ContainsObject(PropActiveMdiChild))
         {
             base.Properties.SetObject(PropActiveMdiChild, null);
         }
         if (this.MdiWindowListStrip != null)
         {
             this.MdiWindowListStrip.Dispose();
             this.MdiWindowListStrip = null;
         }
         if (this.MdiControlStrip != null)
         {
             this.MdiControlStrip.Dispose();
             this.MdiControlStrip = null;
         }
         if (this.MainMenuStrip != null)
         {
             this.MainMenuStrip = null;
         }
         Form form = (Form) base.Properties.GetObject(PropOwner);
         if (form != null)
         {
             form.RemoveOwnedForm(this);
             base.Properties.SetObject(PropOwner, null);
         }
         Form[] formArray = (Form[]) base.Properties.GetObject(PropOwnedForms);
         for (int i = base.Properties.GetInteger(PropOwnedFormsCount) - 1; i >= 0; i--)
         {
             if (formArray[i] != null)
             {
                 formArray[i].Dispose();
             }
         }
         if (this.smallIcon != null)
         {
             this.smallIcon.Dispose();
             this.smallIcon = null;
         }
         this.ResetSecurityTip(false);
         base.Dispose(disposing);
         this.ctlClient = null;
         MainMenu menu = this.Menu;
         if ((menu != null) && (menu.ownerForm == this))
         {
             menu.Dispose();
             base.Properties.SetObject(PropMainMenu, null);
         }
         if (base.Properties.GetObject(PropCurMenu) != null)
         {
             base.Properties.SetObject(PropCurMenu, null);
         }
         this.MenuChanged(0, null);
         MainMenu menu2 = (MainMenu) base.Properties.GetObject(PropDummyMenu);
         if (menu2 != null)
         {
             menu2.Dispose();
             base.Properties.SetObject(PropDummyMenu, null);
         }
         MainMenu menu3 = (MainMenu) base.Properties.GetObject(PropMergedMenu);
         if (menu3 != null)
         {
             if ((menu3.ownerForm == this) || (menu3.form == null))
             {
                 menu3.Dispose();
             }
             base.Properties.SetObject(PropMergedMenu, null);
         }
     }
     else
     {
         base.Dispose(disposing);
     }
 }