/// <summary> /// Initializes the board. /// </summary> private void InitializeBoard() { gameBoardTable.SuspendLayout(); gameBoardTable.Controls.Clear(); gameBoardTable.RowCount = Game.NumberOfRows; gameBoardTable.ColumnCount = Game.NumberOfColumns; foreach (RowStyle rowStyle in gameBoardTable.RowStyles) { rowStyle.SizeType = SizeType.AutoSize; } foreach (ColumnStyle colStyle in gameBoardTable.ColumnStyles) { colStyle.SizeType = SizeType.AutoSize; } for (int playerIndex = 0; playerIndex < Game.PlayerStates.Count; playerIndex++) { var playerState = Game.PlayerStates[playerIndex]; playerState.GameBoardTiles.ForEach(gameBoardTile => { var tileDisplay = new TileDisplay(gameBoardTile, playerState.PlayerName); gameBoardTable.Controls.Add(tileDisplay, gameBoardTile.Column, gameBoardTile.Row + Game.NumberOfRows * playerIndex); tileDisplay.Draw(); tileDisplay.Click += TileDisplay_Click; }); } gameBoardTable.ResumeLayout(); }