示例#1
0
        void RestartButton_Click(object sender, EventArgs e)
        {
            matched      = 0;
            timePassed   = 0;
            NameBox.Text = "";
            StartTimer.Start();
            NameBox.Hide();
            AskName.Hide();
            DisplayVictory.Hide();
            SubmitButton.Hide();

            Deck deck = new Deck();

            PictureBox[] boxes = new PictureBox[] { pictureBox1, pictureBox2, pictureBox3, pictureBox4, pictureBox5, pictureBox6, pictureBox7, pictureBox8, pictureBox9, pictureBox10, pictureBox11, pictureBox12, pictureBox13, pictureBox14, pictureBox15, pictureBox16 };


            totalCards = boxes.Count();
            foreach (PictureBox pictureBox in boxes)
            {
                Card card = deck.Deal();
                pictureBox.Image = card.CurrentImage;
                pictureBox.Tag   = card;
                pictureBox.Show();
            }
        }
示例#2
0
        public void CreateFigure() //For spawning create Picbox & Spawn(name,x,y)
        {
            Random FigureGeneration = new Random();
            int    SpawningFigure   = FigureGeneration.Next(0, FiguresCount);

            int[] Spawn_coords = FCoords[SpawningFigure];
            currentColor = FigureColors[SpawningFigure];
            PictureBox[] Created = new PictureBox[Spawn_coords.Length / 2];
            for (int i = 0; i < Spawn_coords.Length / 2; i++)
            {
                Created[i] = new PictureBox();
            }
            label1.Text = Created.Length.ToString();
            for (int i = 0; i < Created.Count(); i++)
            {
                Spawn(Created[i], Spawn_coords[2 * i], Spawn_coords[2 * i + 1], currentColor);
            }
        }
示例#3
0
        /// <summary>
        /// 刷新图片
        /// </summary>
        private void RefImgList()
        {
            var count   = this.PicList.Count();
            var picCopy = new PictureBox[count];

            this.PicList.CopyTo(picCopy);
            for (int i = 0; i < picCopy.Count(); i++)
            {
                //队列里存在图片就按索引对应
                if (i < this.Images.Count)
                {
                    this.PicList[i].Image = this.Images[i].SuoImg;
                }
                else
                {
                    var removePic = picCopy[i];
                    this.PicList.Remove(removePic);
                    this.picPanel.Controls.Remove(removePic);
                }
            }
            this.SetDetailImg();
        }