Exemplo n.º 1
0
        protected virtual void HorizontalLayoutDock(ContainerControl control)
        {
            if (WrapMaxSize <= 0)
            {
                Point minSize      = control.BiggestMinimumChildSize();
                int   proposedSize = control.Bounds.Size.Y - control.Box.Padding.TopAndBottom - control.Box.Borders.TopAndBottom;
                if (proposedSize < minSize.Y)
                {
                    proposedSize = minSize.Y;
                }

                foreach (Control child in control.Children)
                {
                    child.SetBoundsToMinimumSize();
                    if (child.ShouldStretchHorizontally && child == control.Children.Tail)
                    {
                        //child.Bounds.Location.X = control.Bounds.Location.X + XMargin;
                        child.Bounds.Size.X = control.Bounds.Right - child.Bounds.Location.X;
                    }
                    if (child.ShouldStretchVertically)
                    {
                        child.Bounds.Size.Y = proposedSize;
                    }
                    if (child.Stretch != StretchMode.None)
                    {
                        child.LayoutDock();
                    }
                }
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Internal helper to align vertically
        /// </summary>
        /// <param name="control">control whose child controls are to be aligned</param>
        protected virtual void VerticalLayout(ContainerControl control)
        {
            bool someChildAlreadyProcessed = false;

            int ox = control.Bounds.Location.X;
            int oy = control.Bounds.Location.Y;

            int x = ox + control.Box.Borders.Left + control.Box.Padding.Left;
            int y = oy + control.Box.Borders.Top + control.Box.Padding.Top;

            Point maxSize   = control.BiggestMinimumChildSize();
            Point childSize = new Point();

            foreach (Control child in control.Children)
            {
                if (child.Visible)
                {
                    if (!someChildAlreadyProcessed)
                    {
                        someChildAlreadyProcessed = true;
                    }
                    else
                    {
                        y += YSpacing;
                    }

                    int moveToX = x;

                    child.CalcSizeWithMargins(child.MinimumRequiredSize, childSize);

                    switch (this.Alignment)
                    {
                    case AlignmentType.Center:
                        moveToX = x + (maxSize.X - childSize.X) / 2;
                        break;

                    case AlignmentType.RightOrBottomEdge:
                        moveToX = x + (maxSize.X - childSize.X);
                        break;

                    case AlignmentType.Justify:
                    //child.Bounds.Size.X = maxSize;
                    //moveToX = x;
                    //break;
                    case AlignmentType.LeftOrTopEdge:
                    default:
                        break;
                    }

                    child.MoveTo(moveToX + child.Box.Margins.Left, y + child.Box.Margins.Top);

                    y += childSize.Y;
                }
            }

            x += maxSize.X + control.Box.Borders.Right + control.Box.Padding.Right;
            y += control.Box.Borders.Bottom + control.Box.Padding.Bottom;

            control.Bounds.Size.Set(x - ox, y - oy);
        }
Exemplo n.º 3
0
        protected virtual void VerticalLayoutDock(ContainerControl control)
        {
            if (WrapMaxSize <= 0)
            {
                Point minSize      = control.BiggestMinimumChildSize();
                int   proposedSize = control.Bounds.Size.X - control.Box.Padding.LeftAndRight - control.Box.Borders.LeftAndRight;
                if (proposedSize < minSize.X)
                {
                    proposedSize = minSize.X;
                }

                foreach (Control child in control.Children)
                {
                    child.SetBoundsToMinimumSize();
                    if (child.ShouldStretchHorizontally)
                    {
                        //child.Bounds.Location.X = control.Bounds.Location.X + XMargin;
                        child.Bounds.Size.X = proposedSize - child.Box.Margins.LeftAndRight;
                    }
                    child.LayoutDock();
                }
            }
        }
Exemplo n.º 4
0
        protected virtual void VerticalLayoutDock(ContainerControl control)
        {
            if (WrapMaxSize <= 0)
            {
                Point minSize = control.BiggestMinimumChildSize();
                int proposedSize = control.Bounds.Size.X - control.Box.Padding.LeftAndRight - control.Box.Borders.LeftAndRight;
                if (proposedSize < minSize.X) proposedSize = minSize.X;

                foreach (Control child in control.Children)
                {
                    child.SetBoundsToMinimumSize();
                    if (child.ShouldStretchHorizontally)
                    {
                        //child.Bounds.Location.X = control.Bounds.Location.X + XMargin;
                        child.Bounds.Size.X = proposedSize - child.Box.Margins.LeftAndRight;
                    }
                    child.LayoutDock();
                }
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// Internal helper to align vertically
        /// </summary>
        /// <param name="control">control whose child controls are to be aligned</param>
        protected virtual void VerticalLayout(ContainerControl control)
        {
            bool someChildAlreadyProcessed = false;

            int ox = control.Bounds.Location.X;
            int oy = control.Bounds.Location.Y;

            int x = ox + control.Box.Borders.Left + control.Box.Padding.Left;
            int y = oy + control.Box.Borders.Top + control.Box.Padding.Top;

            Point maxSize = control.BiggestMinimumChildSize();
            Point childSize = new Point();

            foreach (Control child in control.Children)
            {
                if (child.Visible)
                {
                    if (!someChildAlreadyProcessed)
                    {
                        someChildAlreadyProcessed = true;
                    }
                    else
                    {
                        y += YSpacing;
                    }

                    int moveToX = x;

                    child.CalcSizeWithMargins(child.MinimumRequiredSize, childSize);

                    switch (this.Alignment)
                    {
                        case AlignmentType.Center:
                            moveToX = x + (maxSize.X - childSize.X) / 2;
                            break;
                        case AlignmentType.RightOrBottomEdge:
                            moveToX = x + (maxSize.X - childSize.X);
                            break;
                        case AlignmentType.Justify:
                        //child.Bounds.Size.X = maxSize;
                        //moveToX = x;
                        //break;
                        case AlignmentType.LeftOrTopEdge:
                        default:
                            break;
                    }

                    child.MoveTo(moveToX + child.Box.Margins.Left, y + child.Box.Margins.Top);

                    y += childSize.Y;
                }
            }

            x += maxSize.X + control.Box.Borders.Right + control.Box.Padding.Right;
            y += control.Box.Borders.Bottom + control.Box.Padding.Bottom;

            control.Bounds.Size.Set(x - ox, y - oy);
        }
Exemplo n.º 6
0
        protected virtual void HorizontalLayoutDock(ContainerControl control)
        {
            if (WrapMaxSize <= 0)
            {
                Point minSize = control.BiggestMinimumChildSize();
                int proposedSize = control.Bounds.Size.Y - control.Box.Padding.TopAndBottom - control.Box.Borders.TopAndBottom;
                if (proposedSize < minSize.Y) proposedSize = minSize.Y;

                foreach (Control child in control.Children)
                {
                    child.SetBoundsToMinimumSize();
                    if (child.ShouldStretchHorizontally && child == control.Children.Tail)
                    {
                        //child.Bounds.Location.X = control.Bounds.Location.X + XMargin;
                        child.Bounds.Size.X = control.Bounds.Right - child.Bounds.Location.X;
                    }
                    if (child.ShouldStretchVertically)
                    {
                        child.Bounds.Size.Y = proposedSize;
                    }
                    if (child.Stretch != StretchMode.None)
                    {
                        child.LayoutDock();
                    }
                }
            }
        }