示例#1
0
        private void Initialize()
        {
            timer.Stop();
            time = 0;

            level = cmbxLevel.SelectedIndex + 1;

            lblMines.Text = MINE_COUNT[level - 1].ToString().PadLeft(4, '0');
            lblTime.Text  = time.ToString().PadLeft(4, '0');

            btnPlay.BackgroundImage = Properties.Resources.happy;

            cells = new int[BOARD_SIZE[level - 1], BOARD_SIZE[level - 1]];

            surface = new Bitmap(this.canvas.Width, this.canvas.Height);

            device = Graphics.FromImage(surface);
            device.SmoothingMode = SmoothingMode.AntiAlias;

            game = new Game(MINE_COUNT[level - 1]);
            game.fillBoard(cells);
            draw();
        }