Ejemplo n.º 1
0
        //turns over all the cards for 1 second
        private void btnHint_Click(object sender, EventArgs e)
        {
            foreach (Control x in this.Controls)
            {
                if (x is PictureBox)

                {
                    Card_Classclass.showImage((x as PictureBox));
                }
            }
            Application.DoEvents();
            btnHint.Enabled = false;             //disable the hint button
            System.Threading.Thread.Sleep(1000); // displays images for 1 second
            resetImages();
        }
Ejemplo n.º 2
0
        //click event for cards
        private void pictureBox1_Click(object sender, EventArgs e)
        {
            if (startGame)
            {
                PictureBox current = (sender as PictureBox);       //first card cliked on
                Card_Classclass.showImage((sender as PictureBox)); //display image
                if (num == 0)
                {
                    prev = current;        // the current card becomes the second card clicked on
                    num  = 1;
                }
                else if (prev != current)
                {
                    foundMatches = Card_Classclass.isMatch(prev, current);
                    num          = 0;
                }
            }

            else
            {
                MessageBox.Show("Please hit start to begin the game.", "UH OH!");
            }
        }