private void Event_MouseClick(object sender, MouseEventArgs e) { if (time == 0) { timer.Start(); } if (game.getGameState() == 0) { game.check(e.Y / (canvas.Width / BOARD_SIZE[level - 1]), e.X / (canvas.Height / BOARD_SIZE[level - 1]), cells, e.Button); draw(); int mines = MINE_COUNT[level - 1] - game.getFlags(); lblMines.Text = (mines < 0 ? 0 : mines).ToString().PadLeft(4, '0'); if (game.getGameState() == GameState.LOST) { timer.Stop(); btnPlay.BackgroundImage = Properties.Resources.sad; MessageBox.Show("You Lost !", "Minesweeper"); } else if (game.getGameState() == GameState.WON) { timer.Stop(); MessageBox.Show("You Win !", "Minesweeper"); } } }