示例#1
0
文件: Panel.cs 项目: orb1t/LayItOut
        protected override Size OnMeasure(Size size, IRendererContext context)
        {
            var panelSize = Margin.GetAbsoluteSize() + Padding.GetAbsoluteSize() + Border.AsSpacer().GetAbsoluteSize();

            Inner?.Measure((size - panelSize).Union(Size.Empty), context);

            return((Inner?.DesiredSize ?? Size.Empty) + panelSize);
        }
示例#2
0
文件: Panel.cs 项目: orb1t/LayItOut
        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();
        }