ComponentFactory.Krypton.Toolkit.ViewLayoutViewport.GetPreferredSize C# (CSharp) Метод

GetPreferredSize() публичный Метод

Discover the preferred size of the element.
public GetPreferredSize ( ViewLayoutContext context ) : Size
context ViewLayoutContext Layout context.
Результат System.Drawing.Size
        public override Size GetPreferredSize(ViewLayoutContext context)
        {
            // Remember the original display rect for restoring late
            Rectangle originalRect = context.DisplayRectangle;

            // Reduce available display rect by the required border sizing
            if (_paletteMetrics != null)
                context.DisplayRectangle = CommonHelper.ApplyPadding(Orientation, originalRect, _paletteMetrics.GetMetricPadding(State, _metricPadding));

            // Cache the maximum extent of all the children
            _extent = base.GetPreferredSize(context);

            // Do we have a metric source for additional padding?
            if (_paletteMetrics == null)
                return _extent;

            // Restore the original display rectangle
            context.DisplayRectangle = originalRect;

            // Apply padding needed outside the border of the canvas
            return CommonHelper.ApplyPadding(Orientation, _extent, _paletteMetrics.GetMetricPadding(State, _metricPadding));
        }