Ejemplo n.º 1
0
        //Start a new beginner game
        private void mnuGameNewGameBeginner_Click(object sender, EventArgs e)
        {
            //Change square size and bar length
            BarLength = 10;
            SquareSize = Properties.Resources.ChocolateTile.Height;

            //Resize Form and centre
            this.Width = (TopLeftPadding * 2) + (SquareSize * BarLength) + 7; //The 7 accounts for the window border
            this.Height = this.Width + 20;
            this.CenterToScreen();

            //Create a new beginner game grid and invalidate it to draw as well as remove previous drawings
            ChocolateGrid = new ChocolateBar(BarLength, SquareSize, TopLeftPadding);
            this.Invalidate();

            //Enable hover detection timer, reset time display, and display number of peanuts left
            timer1.Enabled = true;
            lblSecondsElapsed.Text = ChocolateGrid.SecondsElapsed.ToString();
            lblPeanutsLeft.Text = ChocolateGrid.PeanutsLeft.ToString();
        }
Ejemplo n.º 2
0
        //Start a new intermediate game
        private void mnuGameNewGameIntermediate_Click(object sender, EventArgs e)
        {
            //Change square size and bar length
            BarLength = 20;
            SquareSize = (Screen.PrimaryScreen.WorkingArea.Height - 120) / BarLength;


            //Resize Form and centre
            this.Width = (TopLeftPadding * 2) + (SquareSize * BarLength) + 7; //The 7 accounts for the window border
            this.Height = this.Width + 20;
            this.CenterToScreen();

            //Create a new intermediate game grid and draw it
            ChocolateGrid = new ChocolateBar(BarLength, SquareSize, TopLeftPadding);
            this.Invalidate();

            //Enable hover detection timer, reset time display, and display number of peanuts left
            timer1.Enabled = true;
            lblSecondsElapsed.Text = ChocolateGrid.SecondsElapsed.ToString();
            lblPeanutsLeft.Text = ChocolateGrid.PeanutsLeft.ToString();
        }