Example #1
0
        private void addButtonsToTable()
        {
            m_ButtonsWidth  = tableLayoutPanelBoard.Width / m_BoardColumns;
            m_ButtonsHeight = tableLayoutPanelBoard.Height / m_BoardRows;
            generateCharImageDict(m_Game.GetRandomObjects());
            CellButton cellButton = null;

            for (int i = 0; i < tableLayoutPanelBoard.RowCount; i++)
            {
                for (int j = 0; j < tableLayoutPanelBoard.ColumnCount; j++)
                {
                    if (m_HasInternetConnection)
                    {
                        cellButton = new ImageCellButton(i, j, (PictureBox)m_CharImageDict[m_Game.GetCellValue(i, j, true)]);
                        cellButton = createCellButton(ref cellButton);
                        tableLayoutPanelBoard.Controls.Add(cellButton, j, i);
                    }
                    else
                    {
                        cellButton = new CellButton(i, j);
                        cellButton = createCellButton(ref cellButton);
                        tableLayoutPanelBoard.Controls.Add(cellButton, j, i);
                    }
                }
            }
        }