private void InitializeGuessButtons() { int coordYSpaceBetweenButtons = 15; int previousXCoordLocation = this.m_BlackButtons[0].Location.X; int previousYCoordLocation = this.m_BlackButtons[0].Location.Y; for (int i = 0; i < r_GuessButtonsMatrix.Count; ++i) { r_GuessButtonsMatrix[i][0] = new GameBoardButton(i); var currentFirstRowButton = this.r_GuessButtonsMatrix[i][0]; if (i > 0) { currentFirstRowButton.Enabled = false; } currentFirstRowButton.BackColor = Color.LightGray; currentFirstRowButton.ClientSize = r_GuessButtonSize; currentFirstRowButton.Location = new Point(previousXCoordLocation, previousYCoordLocation + r_GuessButtonSize.Height + coordYSpaceBetweenButtons); for (int j = 1; j < r_NumOfGuessButtonsInARow; ++j) { r_GuessButtonsMatrix[i][j] = new GameBoardButton(i); var currentButton = this.r_GuessButtonsMatrix[i][j]; var previousButton = this.r_GuessButtonsMatrix[i][j - 1]; currentButton.BackColor = Color.LightGray; currentButton.ClientSize = r_GuessButtonSize; if (i > 0) { currentButton.Enabled = false; } currentButton.Location = new Point(previousButton.Location.X + r_GuessButtonSize.Width + r_SpaceBetweenButtonsX, currentFirstRowButton.Location.Y); if (j == 1) { r_GuessButtonsMatrix[i][j - 1].Click += new EventHandler(guess_Click); r_GuessButtonsMatrix[i][j].Click += new EventHandler(guess_Click); } else { r_GuessButtonsMatrix[i][j].Click += new EventHandler(guess_Click); } } previousXCoordLocation = currentFirstRowButton.Location.X; previousYCoordLocation = currentFirstRowButton.Location.Y; coordYSpaceBetweenButtons = 5; } }
private void InitializeResultsButtons() { for (int i = 0; i < r_GuessButtonsMatrix.Count; ++i) { int tinyButtoncoordY = this.r_GuessButtonsMatrix[i][3].Location.Y + 2; int previousButtonCoordX = this.r_GuessButtonsMatrix[i][4].Location.X; /* Upper Buttons */ /* top left */ this.r_GuessButtonsMatrix[i][5] = new GameBoardButton(); this.r_GuessButtonsMatrix[i][5].BackColor = Color.LightGray; this.r_GuessButtonsMatrix[i][5].ClientSize = r_ResultButtonSize; this.r_GuessButtonsMatrix[i][5].Location = new Point(previousButtonCoordX + r_ArrowButtonSize.Width + r_SpaceBetweenButtonsX , tinyButtoncoordY); r_GuessButtonsMatrix[i][5].Enabled = false; /* top right */ previousButtonCoordX = this.r_GuessButtonsMatrix[i][5].Location.X; r_GuessButtonsMatrix[i][6] = new GameBoardButton(); r_GuessButtonsMatrix[i][6].BackColor = Color.LightGray; r_GuessButtonsMatrix[i][6].ClientSize = r_ResultButtonSize; r_GuessButtonsMatrix[i][6].Location = new Point(previousButtonCoordX + r_ResultButtonSize.Width + r_SpaceBetweenButtonsX , tinyButtoncoordY); r_GuessButtonsMatrix[i][6].Enabled = false; /* Lower Buttons */ /* Bottom Left */ r_GuessButtonsMatrix[i][7] = new GameBoardButton(); r_GuessButtonsMatrix[i][7].BackColor = Color.LightGray; r_GuessButtonsMatrix[i][7].ClientSize = r_ResultButtonSize; r_GuessButtonsMatrix[i][7].Location = new Point(this.r_GuessButtonsMatrix[i][5].Location.X, this.r_GuessButtonsMatrix[i][5].Location.Y + r_ResultButtonSize.Height + r_SpaceBetweenButtonsX); r_GuessButtonsMatrix[i][7].Enabled = false; /* Bottom Right */ r_GuessButtonsMatrix[i][8] = new GameBoardButton(); r_GuessButtonsMatrix[i][8].BackColor = Color.LightGray; r_GuessButtonsMatrix[i][8].ClientSize = r_ResultButtonSize; r_GuessButtonsMatrix[i][8].Location = new Point(this.r_GuessButtonsMatrix[i][6].Location.X, this.r_GuessButtonsMatrix[i][7].Location.Y); r_GuessButtonsMatrix[i][8].Enabled = false; } }