Esempio n. 1
0
        public override Size GetPreferredSize(Size constrainingSize)
        {
            ISupportToolStripPanel draggedControl = DraggedControl;
            Size preferredSize = Size.Empty;

            if (draggedControl.Stretch)
            {
                if (ToolStripPanelRow.Orientation == Orientation.Horizontal)
                {
                    constrainingSize.Width = ToolStripPanelRow.Bounds.Width;
                    preferredSize          = _wrappedToolStrip.GetPreferredSize(constrainingSize);
                    preferredSize.Width    = constrainingSize.Width;
                }
                else
                {
                    constrainingSize.Height = ToolStripPanelRow.Bounds.Height;
                    preferredSize           = _wrappedToolStrip.GetPreferredSize(constrainingSize);
                    preferredSize.Height    = constrainingSize.Height;
                }
            }
            else
            {
                preferredSize = (!_wrappedToolStrip.AutoSize) ? _wrappedToolStrip.Size : _wrappedToolStrip.GetPreferredSize(constrainingSize);
            }


            // return LayoutUtils.IntersectSizes(constrainingSize, preferredSize);
            return(preferredSize);
        }