Exemplo n.º 1
0
        private protected override bool LayoutCore(IArrangedElement container, LayoutEventArgs layoutEventArgs)
        {
            if (!(container is ToolStrip))
            {
                throw new NotSupportedException(SR.ToolStripSplitStackLayoutContainerMustBeAToolStrip);
            }

            InvalidateLayout();
            displayRectangle = ToolStrip.DisplayRectangle;

            // pick a location that's outside of the displayed region to send
            // items that will potentially clobber/overlay others.
            noMansLand    = displayRectangle.Location;
            noMansLand.X += ToolStrip.ClientSize.Width + 1;
            noMansLand.Y += ToolStrip.ClientSize.Height + 1;

            if (ToolStrip.LayoutStyle == ToolStripLayoutStyle.HorizontalStackWithOverflow)
            {
                LayoutHorizontal();
            }
            else
            {
                LayoutVertical();
            }

            return(CommonProperties.GetAutoSize(container));
        }
Exemplo n.º 2
0
 internal override bool LayoutCore(IArrangedElement container, LayoutEventArgs layoutEventArgs)
 {
     if (!(container is System.Windows.Forms.ToolStrip))
     {
         throw new NotSupportedException(System.Windows.Forms.SR.GetString("ToolStripSplitStackLayoutContainerMustBeAToolStrip"));
     }
     this.InvalidateLayout();
     this.displayRectangle = this.toolStrip.DisplayRectangle;
     this.noMansLand       = this.displayRectangle.Location;
     this.noMansLand.X    += this.toolStrip.ClientSize.Width + 1;
     this.noMansLand.Y    += this.toolStrip.ClientSize.Height + 1;
     if (this.toolStrip.LayoutStyle == ToolStripLayoutStyle.HorizontalStackWithOverflow)
     {
         this.LayoutHorizontal();
     }
     else
     {
         this.LayoutVertical();
     }
     return(CommonProperties.GetAutoSize(container));
 }