Exemplo n.º 1
0
        protected override void OnArrange()
        {
            if (Inner == null)
            {
                return;
            }

            var clipShift = new Point(-ClipMargin.Left.AbsoluteOrDefault(), -ClipMargin.Top.AbsoluteOrDefault());
            var clipSize  = Inner.DesiredSize.Subtract(ClipMargin.GetAbsoluteSize());
            var shift     = CalculateAlignmentShift(clipSize);
            var location  = Point.Empty;

            location.Offset(clipShift);
            location.Offset(shift);
            location.Offset(Layout.Location);
            Inner.Arrange(new Rectangle(location, Inner.DesiredSize));

            var viewRegionSize = Inner.DesiredSize.Subtract(new Size(
                                                                ClipMargin.Right.AbsoluteOrDefault(),
                                                                ClipMargin.Bottom.AbsoluteOrDefault()))
                                 .Subtract(new Size(Math.Max(0, shift.X), Math.Max(0, shift.Y)));


            var clipped = new Rectangle(location, viewRegionSize);

            clipped.Intersect(Layout);
            ActualViewRegion = clipped;
        }
Exemplo n.º 2
0
        protected override void OnArrange()
        {
            var(widthExpandable, heightExpandable) = WithExpandable(Margin, Border.AsSpacer(), Padding);
            var widths  = widthExpandable.AsEnumerable().GetEnumerator();
            var heights = heightExpandable.AsEnumerable().GetEnumerator();

            BorderLayout  = Layout.ShrinkBy(GetRealSize(Margin, widths, heights));
            PaddingLayout = BorderLayout.ShrinkBy(GetRealSize(Border.AsSpacer(), widths, heights));
            ActualBorder  = CalculateActualBorder(PaddingLayout, BorderLayout);
            Inner?.Arrange(PaddingLayout.ShrinkBy(GetRealSize(Padding, widths, heights)));
            ActualRadius = CalculateActualRadius();
        }