Ejemplo n.º 1
0
 private void Reset()
 {
     Box1.Load("Res/box1.png");
     Box2.Load("Res/box1.png");
     Box3.Load("Res/box1.png");
     Box4.Load("Res/box1.png");
     Box5.Load("Res/box1.png");
     Box6.Load("Res/box1.png");
     Box7.Load("Res/box1.png");
     Box8.Load("Res/box1.png");
     Box9.Load("Res/box1.png");
     Box10.Load("Res/box1.png");
     Box11.Load("Res/box1.png");
     Box12.Load("Res/box1.png");
     Box13.Load("Res/box1.png");
     Box14.Load("Res/box1.png");
     Box15.Load("Res/box1.png");
     Box16.Load("Res/box1.png");
     Box1.Enabled   = false;
     Box2.Enabled   = false;
     Box3.Enabled   = false;
     Box4.Enabled   = false;
     Box5.Enabled   = false;
     Box6.Enabled   = false;
     Box7.Enabled   = false;
     Box8.Enabled   = false;
     Box9.Enabled   = false;
     Box10.Enabled  = false;
     Box11.Enabled  = false;
     Box12.Enabled  = false;
     Box13.Enabled  = false;
     Box14.Enabled  = false;
     Box15.Enabled  = false;
     Box16.Enabled  = false;
     timer1.Enabled = false;
     for (int i = 0; i < 4; i++)
     {
         for (int j = 0; j < 4; j++)
         {
             tab[i, j] = 1;
         }
     }
 }
Ejemplo n.º 2
0
        private void Rand()
        {
            Random        _r      = new Random();
            HashSet <int> IdenCol = new HashSet <int>();

            while (IdenCol.Count < 4)
            {
                IdenCol.Add(_r.Next(1, 5));
            }
            int[] IdenColArray = IdenCol.ToArray();
            for (int i = 0; i < 4; i++)
            {
                int x = IdenColArray[i];
                int y = _r.Next(2, 4);
                switch (i)
                {
                case 0:
                    if (x == 1)
                    {
                        Box1.Load("Res/box" + y.ToString() + ".png"); Box1.Enabled = false; tab[0, 0] = y;
                    }
                    else if (x == 2)
                    {
                        Box2.Load("Res/box" + y.ToString() + ".png"); Box2.Enabled = false; tab[0, 1] = y;
                    }
                    else if (x == 3)
                    {
                        Box3.Load("Res/box" + y.ToString() + ".png"); Box3.Enabled = false; tab[0, 2] = y;
                    }
                    else if (x == 4)
                    {
                        Box4.Load("Res/box" + y.ToString() + ".png"); Box4.Enabled = false; tab[0, 3] = y;
                    }
                    break;

                case 1:
                    if (x == 1)
                    {
                        Box5.Load("Res/box" + y.ToString() + ".png"); Box5.Enabled = false; tab[1, 0] = y;
                    }
                    else if (x == 2)
                    {
                        Box6.Load("Res/box" + y.ToString() + ".png"); Box6.Enabled = false; tab[1, 1] = y;
                    }
                    else if (x == 3)
                    {
                        Box7.Load("Res/box" + y.ToString() + ".png"); Box7.Enabled = false; tab[1, 2] = y;
                    }
                    else if (x == 4)
                    {
                        Box8.Load("Res/box" + y.ToString() + ".png"); Box8.Enabled = false; tab[1, 3] = y;
                    }
                    break;

                case 2:
                    if (x == 1)
                    {
                        Box9.Load("Res/box" + y.ToString() + ".png"); Box9.Enabled = false; tab[2, 0] = y;
                    }
                    else if (x == 2)
                    {
                        Box10.Load("Res/box" + y.ToString() + ".png"); Box10.Enabled = false; tab[2, 1] = y;
                    }
                    else if (x == 3)
                    {
                        Box11.Load("Res/box" + y.ToString() + ".png"); Box11.Enabled = false; tab[2, 2] = y;
                    }
                    else if (x == 4)
                    {
                        Box12.Load("Res/box" + y.ToString() + ".png"); Box12.Enabled = false; tab[2, 3] = y;
                    }
                    break;

                case 3:
                    if (x == 1)
                    {
                        Box13.Load("Res/box" + y.ToString() + ".png"); Box13.Enabled = false; tab[3, 0] = y;
                    }
                    else if (x == 2)
                    {
                        Box14.Load("Res/box" + y.ToString() + ".png"); Box14.Enabled = false; tab[3, 1] = y;
                    }
                    else if (x == 3)
                    {
                        Box15.Load("Res/box" + y.ToString() + ".png"); Box15.Enabled = false; tab[3, 2] = y;
                    }
                    else if (x == 4)
                    {
                        Box16.Load("Res/box" + y.ToString() + ".png"); Box16.Enabled = false; tab[3, 3] = y;
                    }
                    break;
                }
            }
        }