Пример #1
0
        private BoardSquare GetSelectedButton(object sender)
        {
            MinesweeperButton button         = (MinesweeperButton)sender;
            Point             buttonLocation = button.Coordinates;

            return(board.GetSquare(buttonLocation.X, buttonLocation.Y));
        }
Пример #2
0
        private void AddButtons()
        {
            MinesweeperButton button;

            for (int i = 0; i < board.Height; i++)
            {
                for (int j = 0; j < board.Width; j++)
                {
                    buttonArray[j, i]                         = new MinesweeperButton();
                    buttonArray[j, i].Location                = new System.Drawing.Point(i * buttonSize.Height, j * buttonSize.Width + label1.Height);
                    buttonArray[j, i].Name                    = "button" + (j + (i * j));
                    buttonArray[j, i].Coordinates             = new Point(j, i);
                    buttonArray[j, i].Size                    = buttonSize;
                    buttonArray[j, i].UseVisualStyleBackColor = false;
                    this.Controls.Add(buttonArray[j, i]);
                }
            }
        }