Example #1
0
        public Size Measure(BoxConstraint constraint)
        {
            var pt        = GetOffset(constraint);
            var shrink    = constraint.Shrink(pt.X, pt.Y).Loosen();
            var childSize = Child.Measure(shrink);

            return(GetUsedSize(constraint, childSize));
        }
Example #2
0
        public Size Draw(Point offset, BoxConstraint constraint, UIContext context)
        {
            var pt        = GetOffset(constraint);
            var shrink    = constraint.Shrink(pt.X, pt.Y).Loosen();
            var childSize = Child.Draw(new Point(pt.X + offset.X, pt.Y + offset.Y), shrink, context);

            return(GetUsedSize(constraint, childSize));
        }
Example #3
0
        public Size Measure(BoxConstraint constraint)
        {
            var x         = Padding.Left + Padding.Right;
            var y         = Padding.Top + Padding.Bottom;
            var shrink    = constraint.Shrink(x, y);
            var childSize = Child.Measure(shrink);

            return(new Size(childSize.Width + x, childSize.Height + y));
        }
Example #4
0
        public Size Draw(Point offset, BoxConstraint constraint, UIContext context)
        {
            var x         = Padding.Left + Padding.Right;
            var y         = Padding.Top + Padding.Bottom;
            var shrink    = constraint.Shrink(x, y);
            var pt        = new Point(offset.X + Padding.Left, offset.Y + Padding.Top);
            var childSize = Child.Draw(pt, shrink, context);

            return(new Size(childSize.Width + x, childSize.Height + y));
        }
Example #5
0
        public Size Measure(BoxConstraint constraint)
        {
            if (Border == null)
            {
                return(Child.Measure(constraint));
            }

            // measure for the fitted space
            var shrink    = constraint.Shrink(2, 2);
            var childSize = Child.Measure(shrink);

            // now add the border back
            return(new Size(childSize.Width + 2, childSize.Height + 2));
        }
Example #6
0
        public Size Draw(Point offset, BoxConstraint constraint, UIContext context)
        {
            if (Border == null)
            {
                return(Child.Draw(offset, constraint, context));
            }

            // measure for the fitted space
            var shrink    = constraint.Shrink(2, 2);
            var childSize = Child.Draw(new Point(offset.X + 1, offset.Y + 1), shrink, context);

            var bordered = new Size(childSize.Width + 2, childSize.Height + 2);

            DrawBorder(new Rectangle(offset, bordered), bordered, context);

            return(bordered);
        }