コード例 #1
0
        internal override Size GetPreferredSize(IArrangedElement container, Size proposedConstraints) {
#if DEBUG        
            if (CompModSwitches.FlowLayout.TraceInfo) {            
                Debug.WriteLine("FlowLayout::GetPreferredSize("
                    + "container=" + container.ToString() + ", "
                    + "proposedConstraints=" + proposedConstraints.ToString() + ")");
                Debug.Indent();
            }
#endif
            Rectangle measureBounds = new Rectangle(new Point(0, 0), proposedConstraints);
            Size prefSize = xLayout(container, measureBounds, /* measureOnly = */ true);

            if(prefSize.Width > proposedConstraints.Width || prefSize.Height> proposedConstraints.Height) {
                // Controls measured earlier than a control which couldn't be fit to constraints may
                // shift around with the new bounds.  We need to make a 2nd pass through the
                // controls using these bounds which are gauranteed to fit.
                measureBounds.Size = prefSize;
                prefSize = xLayout(container, measureBounds, /* measureOnly = */ true);
            }

#if DEBUG
            if (CompModSwitches.FlowLayout.TraceInfo) {
                Debug.Unindent();
                Debug.WriteLine("GetPreferredSize returned " + prefSize);
            }
#endif
            return prefSize;
        }
コード例 #2
0
        // Entry point from LayoutEngine
        internal override bool LayoutCore(IArrangedElement container, LayoutEventArgs args) {
#if DEBUG        
            if (CompModSwitches.FlowLayout.TraceInfo) {
                Debug.WriteLine("FlowLayout::Layout("
                    + "container=" + container.ToString() + ", "
                    + "displayRect=" + container.DisplayRectangle.ToString() + ", "
                    + "args=" + args.ToString() + ")");
            }
            Debug.Indent();
#endif            

            // ScrollableControl will first try to get the layoutbounds from the derived control when 
            // trying to figure out if ScrollBars should be added.
            // VSWhidbey #392913            
            CommonProperties.SetLayoutBounds(container, xLayout(container, container.DisplayRectangle, /* measureOnly = */ false));
#if DEBUG
            Debug.Unindent();
#endif
            return CommonProperties.GetAutoSize(container);
        }
コード例 #3
0
        private protected override bool LayoutCore(IArrangedElement container, LayoutEventArgs args)
        {
#if DEBUG
            if (CompModSwitches.FlowLayout.TraceInfo)
            {
                Debug.WriteLine("FlowLayout::Layout("
                                + "container=" + container.ToString() + ", "
                                + "displayRect=" + container.DisplayRectangle.ToString() + ", "
                                + "args=" + args.ToString() + ")");
            }
            Debug.Indent();
#endif

            // ScrollableControl will first try to get the layoutbounds from the derived control when
            // trying to figure out if ScrollBars should be added.
            CommonProperties.SetLayoutBounds(container, TryCalculatePreferredSize(container, container.DisplayRectangle, /* measureOnly = */ false));
#if DEBUG
            Debug.Unindent();
#endif
            return(CommonProperties.GetAutoSize(container));
        }