示例#1
0
 public VerticalBox(Box box, double rest, TexAlignment alignment)
     : this()
 {
     this.Add(box);
     if (alignment == TexAlignment.Center)
     {
         var strutBox = new StrutBox(0, rest / 2, 0, 0);
         base.Add(0, strutBox);
         this.Height += rest / 2;
         this.Depth  += rest / 2;
         base.Add(strutBox);
     }
     else if (alignment == TexAlignment.Top)
     {
         this.Depth += rest;
         base.Add(new StrutBox(0, rest, 0, 0));
     }
     else if (alignment == TexAlignment.Bottom)
     {
         this.Height += rest;
         base.Add(0, new StrutBox(0, rest, 0, 0));
     }
 }
示例#2
0
        public HorizontalBox(Box box, double width, TexAlignment alignment)
            : this()
        {
            var extraWidth = width - box.Width;

            if (alignment == TexAlignment.Center)
            {
                var strutBox = new StrutBox(extraWidth / 2, 0, 0, 0);
                this.Add(strutBox);
                this.Add(box);
                this.Add(strutBox);
            }
            else if (alignment == TexAlignment.Left)
            {
                this.Add(box);
                this.Add(new StrutBox(extraWidth, 0, 0, 0));
            }
            else if (alignment == TexAlignment.Right)
            {
                this.Add(new StrutBox(extraWidth, 0, 0, 0));
                this.Add(box);
            }
        }