예제 #1
0
        private void _ResizeDivs()
        {
            // Resize widths
            int fixedWidth     = Divs.Where(x => !x.AutoWidth).Sum(x => x.Width);
            int remainderWidth = Width - fixedWidth;

            List <Div> autoDivs = Divs.Where(x => x.AutoWidth).ToList();

            if (autoDivs.Count > 0)
            {
                int newWidth = remainderWidth / autoDivs.Count;
                autoDivs.ForEach(x => x.Width = newWidth);
            }

            // Resize heights
            Divs.ForEach(x =>
            {
                if (x.AutoHeight)
                {
                    x.Height = Height;
                }
            });
        }
예제 #2
0
 public override void Draw(SpriteBatch spriteBatch, TextureFrameStore textureFrames)
 {
     this.DrawBorder(spriteBatch, textureFrames, BorderWidth, BorderColor);
     Divs.ForEach(x => x.Draw(spriteBatch, textureFrames));
 }