public void Expand(int top, int bottom, int left, int right) { Dictionary <DrawBox, DrawBoxAlignment> alignments = new Dictionary <DrawBox, DrawBoxAlignment>(); foreach (var d in DrawBoxList) { alignments.Add(d, d.Alignment); d.Alignment = DrawBoxAlignment.GetEmpty(); } Y -= top; Height += top; Height += bottom; X -= left; Width += left; Width += right; foreach (var d in DrawBoxList) { d.X += top; d.Y += bottom; d.Alignment = alignments[d]; } }
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]; } }
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]; } }