private void clearAndEnableButton(BoardButton i_CurrentButton) { i_CurrentButton.Enabled = true; i_CurrentButton.BackColor = BoardButton.DefaultBackColor; i_CurrentButton.UseVisualStyleBackColor = true; i_CurrentButton.Refresh(); }
private void drawBoard() { int x = k_SpeaceBetweenButtons; int y = k_SpeaceBetweenButtons; int width = 93; int hight = 93; for (int i = 0; i < r_RowsSize; i++) { for (int j = 0; j < r_ColsSize; j++) { BoardButton buildButton = new BoardButton(i, j); r_BulidBoardButtons[i, j] = buildButton; buildButton.Size = new Size(width, hight); buildButton.Location = new Point(x, y); buildButton.Click += new EventHandler(boardButton_click); Controls.Add(buildButton); x += width + k_SpeaceBetweenButtons; } y += hight + k_SpeaceBetweenButtons; x = k_SpeaceBetweenButtons; } Size = new Size((width * r_ColsSize) + ((r_ColsSize + 2) * k_SpeaceBetweenButtons), (hight * (r_RowsSize + 1)) + ((r_RowsSize + 3) * k_SpeaceBetweenButtons)); Player1Name.Text = string.Format("{0}: ", r_FirstPlayerName); Player2Name.Text = string.Format("{0}: ", r_SecondPlayerName); Player1Pairs.Text = "0 Pairs"; Player2Pairs.Text = "0 Pairs"; Player1Name.AutoSize = true; Player2Name.AutoSize = true; CurrentPlayerName.AutoSize = true; }
private void boardButton_click(object sender, EventArgs e) { BoardButton currentButton = sender as BoardButton; m_Game.PlayerMove(currentButton.Rows, currentButton.Cols); if (m_IsAgainstComputer) { computerPlay(); } }