Пример #1
0
        public virtual void WrapHeight()
        {
            Dictionary <DrawBox, DrawBoxAlignment> alignments = new Dictionary <DrawBox, DrawBoxAlignment>();

            foreach (var d in DrawBoxList)
            {
                alignments.Add(d, d.Alignment);
                d.Alignment = DrawBoxAlignment.GetEmpty();
            }

            int leastY = 0;

            if (DrawBoxList.Count != 0)
            {
                leastY = DrawBoxList[0].Y;
            }
            foreach (DrawBox drawBox in DrawBoxList)
            {
                if (drawBox.Y < leastY)
                {
                    leastY = drawBox.Y;
                }
            }

            foreach (DrawBox drawBox in DrawBoxList)
            {
                drawBox.Y -= leastY;
            }

            Height = MinHeight;
            foreach (DrawBox drawBox in DrawBoxList)
            {
                if (drawBox.Y + drawBox.Height > Height)
                {
                    Height = drawBox.Y + drawBox.Height;
                }
            }

            foreach (var d in DrawBoxList)
            {
                d.Alignment = alignments[d];
            }
        }
Пример #2
0
        public virtual void WrapWidth()
        {        //TODO: FIX THIS!!!
            Dictionary <DrawBox, DrawBoxAlignment> alignments = new Dictionary <DrawBox, DrawBoxAlignment>();

            foreach (var d in DrawBoxList)
            {
                alignments.Add(d, d.Alignment);
                d.Alignment = DrawBoxAlignment.GetEmpty();
            }

            int leastX = 0;

            foreach (DrawBox drawBox in DrawBoxList)
            {
                if (drawBox.X < leastX)
                {
                    leastX = drawBox.X;
                }
            }

            foreach (DrawBox drawBox in DrawBoxList)
            {
                drawBox.X += -leastX;
            }

            Width = 0;
            foreach (DrawBox drawBox in DrawBoxList)
            {
                if (drawBox.X + drawBox.Width > Width)
                {
                    Width = drawBox.X + drawBox.Width;
                }
            }

            foreach (var d in DrawBoxList)
            {
                d.Alignment = alignments[d];
            }
        }