public ToolStripContainer()
        {
            SetStyle(ControlStyles.ResizeRedraw | ControlStyles.SupportsTransparentBackColor, true);

            SuspendLayout();
            try {
                // undone - smart demand creation
                topPanel          = new ToolStripPanel(this);
                bottomPanel       = new ToolStripPanel(this);
                leftPanel         = new ToolStripPanel(this);
                rightPanel        = new ToolStripPanel(this);
                contentPanel      = new ToolStripContentPanel();
                contentPanel.Dock = DockStyle.Fill;
                topPanel.Dock     = DockStyle.Top;
                bottomPanel.Dock  = DockStyle.Bottom;
                rightPanel.Dock   = DockStyle.Right;
                leftPanel.Dock    = DockStyle.Left;

                ToolStripContainerTypedControlCollection controlCollection = this.Controls as ToolStripContainerTypedControlCollection;
                if (controlCollection != null)
                {
                    controlCollection.AddInternal(contentPanel);
                    controlCollection.AddInternal(leftPanel);
                    controlCollection.AddInternal(rightPanel);
                    controlCollection.AddInternal(topPanel);
                    controlCollection.AddInternal(bottomPanel);
                }
                // else consider throw new exception
            }
            finally {
                ResumeLayout(true);
            }
        }
Example #2
0
 public ToolStripContainer()
 {
     base.SetStyle(ControlStyles.SupportsTransparentBackColor | ControlStyles.ResizeRedraw, true);
     base.SuspendLayout();
     try
     {
         this.topPanel          = new ToolStripPanel(this);
         this.bottomPanel       = new ToolStripPanel(this);
         this.leftPanel         = new ToolStripPanel(this);
         this.rightPanel        = new ToolStripPanel(this);
         this.contentPanel      = new ToolStripContentPanel();
         this.contentPanel.Dock = DockStyle.Fill;
         this.topPanel.Dock     = DockStyle.Top;
         this.bottomPanel.Dock  = DockStyle.Bottom;
         this.rightPanel.Dock   = DockStyle.Right;
         this.leftPanel.Dock    = DockStyle.Left;
         ToolStripContainerTypedControlCollection controls = this.Controls as ToolStripContainerTypedControlCollection;
         if (controls != null)
         {
             controls.AddInternal(this.contentPanel);
             controls.AddInternal(this.leftPanel);
             controls.AddInternal(this.rightPanel);
             controls.AddInternal(this.topPanel);
             controls.AddInternal(this.bottomPanel);
         }
     }
     finally
     {
         base.ResumeLayout(true);
     }
 }