Exemple #1
0
        /// <summary>
        /// Moves the items so that their bounding boxes all have the Top (y) value of the
        /// top-most item</summary>
        /// <param name="items">Items to move</param>
        /// <param name="layoutContext">Layout context of items to move</param>
        public virtual void AlignTops(IEnumerable <object> items, ILayoutContext layoutContext)
        {
            Rectangle bounds;

            LayoutContexts.GetBounds(layoutContext, items, out bounds);
            foreach (object item in items)
            {
                layoutContext.SetBounds(item, bounds, BoundsSpecified.Y);
            }
        }
Exemple #2
0
        /// <summary>
        /// Moves the items so that their bounding boxes all have the Right (x + Width) value
        /// of the right-most item</summary>
        /// <param name="items">Items to move</param>
        /// <param name="layoutContext">Layout context of items to move</param>
        public virtual void AlignRights(IEnumerable <object> items, ILayoutContext layoutContext)
        {
            Rectangle bounds;

            LayoutContexts.GetBounds(layoutContext, items, out bounds);
            foreach (object item in items)
            {
                Rectangle itemBounds;
                layoutContext.GetBounds(item, out itemBounds);
                itemBounds.X = bounds.Right - itemBounds.Width;
                layoutContext.SetBounds(item, itemBounds, BoundsSpecified.X);
            }
        }
Exemple #3
0
        /// <summary>
        /// Moves the items so that their bounding boxes all have the Bottom (y + Height) value
        /// of the bottom-most item</summary>
        /// <param name="items">Items to move</param>
        /// <param name="layoutContext">Layout context of items to move</param>
        public virtual void AlignBottoms(IEnumerable <object> items, ILayoutContext layoutContext)
        {
            Rectangle bounds;

            LayoutContexts.GetBounds(layoutContext, items, out bounds);
            foreach (object item in items)
            {
                Rectangle itemBounds;
                layoutContext.GetBounds(item, out itemBounds);
                itemBounds.Y = bounds.Bottom - itemBounds.Height;
                layoutContext.SetBounds(item, itemBounds, BoundsSpecified.Y);
            }
        }