public RestartButton(GameGrid game, int x) { int n = Convert.ToInt16(Math.Floor(Convert.ToDecimal(x / 2))); this.Location = new Point(n * 30, 0); this.Size = new Size(30, 30); this.game = game; this.Image = Properties.Resources.SmileFace; this.MouseClick += new MouseEventHandler(RestartClick); }
private void Form1_Load(object sender, EventArgs e) { FlagsCounting box = new FlagsCounting(); game = new GameGrid(this.rows, this.cols, this, box) { nflags = mines }; this.Controls.Add(game.button); this.Controls.Add(box); game.Start(); }
public Square(int i, int j, GameGrid game, FlagsCounting box) { this.Font = new Font("Segoe UI", 12, FontStyle.Bold); this.FlatAppearance.BorderColor = Color.Black; this.FlatStyle = FlatStyle.Flat; this.box = box; this.Location = new Point(i * 30, (j + 1) * 30); this.Size = new Size(30, 30); this.BackColor = Color.FromArgb(180, 180, 180); this.game = game; this.row_pos = i; this.col_pos = j; this.mined = false; this.flagged = false; this.revealed = false; this.mines_nearby = 0; this.MouseDown += new MouseEventHandler(SquareClick); }