Esempio n. 1
0
        protected override void ArrangeCore(RectangleF finalRect)
        {
            Control control = this.ElementTree.Control;
            SizeF   size    = finalRect.Size;

            size.Width  = Math.Max(0.0f, size.Width);
            size.Height = Math.Max(0.0f, size.Height);
            SizeF desiredSize = this.DesiredSize;

            if (!this.StretchHorizontally)
            {
                size.Width = desiredSize.Width;
            }
            if (!this.StretchVertically)
            {
                size.Height = desiredSize.Height;
            }
            RadElement.MinMax minMax    = new RadElement.MinMax((RadElement)this);
            SizeF             finalSize = new SizeF(Math.Max(size.Width, 0.0f), Math.Max(size.Height, 0.0f));

            finalSize.Width  = Math.Max(minMax.minWidth, Math.Min(finalSize.Width, minMax.maxWidth));
            finalSize.Height = Math.Max(minMax.minHeight, Math.Min(finalSize.Height, minMax.maxHeight));
            SizeF sizeF1 = this.ArrangeOverride(finalSize);
            SizeF sizeF2 = sizeF1;

            if ((double)minMax.maxWidth > 0.0)
            {
                sizeF2.Width = Math.Min(sizeF1.Width, minMax.maxWidth);
            }
            if ((double)minMax.maxHeight > 0.0)
            {
                sizeF2.Height = Math.Min(sizeF1.Height, minMax.maxHeight);
            }
            Rectangle rectangle = new Rectangle(Point.Ceiling(finalRect.Location), Size.Ceiling(sizeF2));

            this.Bounds = rectangle;
            if (control == null || !control.AutoSize || this.GetBitState(140737488355328L))
            {
                return;
            }
            control.Size = rectangle.Size;
        }
Esempio n. 2
0
        protected override SizeF MeasureCore(SizeF availableSize)
        {
            SizeF availableSize1 = new SizeF(Math.Max(availableSize.Width, 0.0f), Math.Max(availableSize.Height, 0.0f));

            RadElement.MinMax minMax = new RadElement.MinMax((RadElement)this);
            availableSize1.Width  = Math.Max(minMax.minWidth, Math.Min(availableSize1.Width, minMax.maxWidth));
            availableSize1.Height = Math.Max(minMax.minHeight, Math.Min(availableSize1.Height, minMax.maxHeight));
            if (!this.StretchHorizontally)
            {
                availableSize1.Width = float.PositiveInfinity;
            }
            if (!this.StretchVertically)
            {
                availableSize1.Height = float.PositiveInfinity;
            }
            if ((double)minMax.maxWidth > 0.0 && (double)availableSize1.Width > (double)minMax.maxWidth)
            {
                availableSize1.Width = minMax.maxWidth;
            }
            if ((double)minMax.maxHeight > 0.0 && (double)availableSize1.Height > (double)minMax.maxHeight)
            {
                availableSize1.Height = minMax.maxHeight;
            }
            SizeF sizeF = this.MeasureOverride(availableSize1);

            sizeF = new SizeF(Math.Max(sizeF.Width, minMax.minWidth), Math.Max(sizeF.Height, minMax.minHeight));
            if ((double)sizeF.Width > (double)minMax.maxWidth && (double)minMax.maxWidth > 0.0)
            {
                sizeF.Width = minMax.maxWidth;
            }
            if ((double)sizeF.Height > (double)minMax.maxHeight && (double)minMax.maxHeight > 0.0)
            {
                sizeF.Height = minMax.maxHeight;
            }
            return(new SizeF(Math.Max(0.0f, sizeF.Width), Math.Max(0.0f, sizeF.Height)));
        }