public HorizontalBox(Box box, double width, TexAlignment alignment) : this() { var extraWidth = width - box.Width; switch (alignment) { case TexAlignment.Center: var strutBox = new StrutBox(extraWidth / 2, 0, 0, 0); Add(strutBox); Add(box); Add(strutBox); break; case TexAlignment.Left: Add(box); Add(new StrutBox(extraWidth, 0, 0, 0)); break; case TexAlignment.Right: Add(new StrutBox(extraWidth, 0, 0, 0)); Add(box); break; } }
public VerticalBox(Box box, double rest, TexAlignment alignment) { Add(box); switch (alignment) { case TexAlignment.Center: var strutBox = new StrutBox(0, rest / 2, 0, 0); base.Add(0, strutBox); Height += rest / 2; Depth += rest / 2; base.Add(strutBox); break; case TexAlignment.Top: Depth += rest; base.Add(new StrutBox(0, rest, 0, 0)); break; case TexAlignment.Bottom: Height += rest; base.Add(0, new StrutBox(0, rest, 0, 0)); break; } }