Exemplo n.º 1
0
        protected override void OnLayout(LayoutEventArgs e)
        {
            base.OnLayout(e);

            int size = ClientRectangle.Height;

            int padding = 30;

            size -= padding * 2;

            int squareSize = size / 8;

            for (int y = 0; y < 8; y++)
            {
                for (int x = 0; x < 8; x++)
                {
                    Square square = _squares[x, y];
                    square.Width  = squareSize;
                    square.Height = squareSize;
                    square.Left   = x * squareSize + padding;
                    square.Top    = y * squareSize + padding;
                    square.Invalidate();
                }
            }
        }