Esempio n. 1
0
        }           //Zavrseno! -Otklonjen bag uz ivicu

        private void label1_Click(object sender, EventArgs e)
        {
            label6.Visible = false;
            for (int y = 1; y < 481; y++)
            {
                Controls["panel" + y].BackColor = Color.White;
            }
            int br = r.Next(1, 20);

            switch (br)
            {
            case 1: f = new Kvadrat(); F = 1; oboji(Color.Yellow); break;

            case 2: f = new Cetvorka1(); F = 2; oboji(Color.Green); break;

            case 3: f = new Linija1(); F = 3; oboji(Color.LightBlue); break;

            case 4: f = new El1(); F = 4; oboji(Color.OrangeRed); break;

            case 5: f = new Linija2(); F = 5; oboji(Color.LightBlue); break;

            case 6: f = new El2(); F = 6; oboji(Color.OrangeRed); break;

            case 7: f = new El3(); F = 7; oboji(Color.OrangeRed); break;

            case 8: f = new El4(); F = 8; oboji(Color.OrangeRed); break;

            case 9: f = new Cetvorka2(); F = 9; oboji(Color.Green); break;

            case 10: f = new T1(); F = 10; oboji(Color.Purple); break;

            case 11: f = new T2(); F = 11; oboji(Color.Purple); break;

            case 12: f = new T3(); F = 12; oboji(Color.Purple); break;

            case 13: f = new T4(); F = 13; oboji(Color.Purple); break;

            case 14: f = new El5(); F = 14; oboji(Color.Blue); break;

            case 15: f = new El6(); F = 15; oboji(Color.Blue); break;

            case 16: f = new El7(); F = 16; oboji(Color.Blue); break;

            case 17: f = new El8(); F = 17; oboji(Color.Blue); break;

            case 18: f = new Cetvorka3(); F = 18; oboji(Color.Red); break;

            case 19: f = new Cetvorka4(); F = 19; oboji(Color.Red); break;
            }
            timer1.Start();
            label1.Enabled = false;
        }
Esempio n. 2
0
        }                                    //

        private void timer1_Tick(object sender, EventArgs e)
        {
            int ubrzanje;

            dalje = 0;
            int s0 = f.koord[0] + 20, s1 = f.koord[1] + 20, s2 = f.koord[2] + 20, s3 = f.koord[3] + 20;

            switch (F)
            {
            case 1: provera_2(s2, s3); break;

            case 2: provera_2(s1, s3); break;

            case 3: provera_4(s0, s1, s2, s3); break;

            case 4: provera_2(s2, s3); break;

            case 5: provera_1(s3); break;

            case 6: provera_3(s1, s2, s3); break;

            case 7: provera_2(s0, s3); break;

            case 8: provera_3(s1, s2, s3); break;

            case 9: provera_3(s1, s2, s3); break;

            case 10: provera_3(s1, s2, s3); break;

            case 11: provera_2(s1, s3); break;

            case 12: provera_3(s0, s2, s3); break;

            case 13: provera_2(s2, s3); break;

            case 14: provera_2(s2, s3); break;

            case 15: provera_3(s1, s2, s3); break;

            case 16: provera_2(s1, s3); break;

            case 17: provera_3(s0, s1, s3); break;

            case 18: provera_2(s2, s3); break;

            case 19: provera_3(s0, s2, s3); break;
            }

            if ((f.koord[3] > 460) || (dalje == 1))
            {
                timer1.Stop();
                popunjeno();
                ubrzanje        = Convert.ToInt32(label5.Text) / 200;
                timer1.Interval = 500 - 20 * ubrzanje;
                int br = r.Next(1, 20);
                switch (br)
                {
                case 1: f = new Kvadrat(); F = 1; b = Color.Yellow; break;              //

                case 2: f = new Cetvorka1(); F = 2; b = Color.Green; break;             //

                case 3: f = new Linija1(); F = 3; b = Color.LightBlue; break;           //

                case 4: f = new El1(); F = 4; b = Color.OrangeRed; break;               //

                case 5: f = new Linija2(); F = 5; b = Color.LightBlue; break;           //

                case 6: f = new El2(); F = 6; b = Color.OrangeRed; break;               //

                case 7: f = new El3(); F = 7; b = Color.OrangeRed; break;               //

                case 8: f = new El4(); F = 8; b = Color.OrangeRed; break;               //

                case 9: f = new Cetvorka2(); F = 9; b = Color.Green; break;             //

                case 10: f = new T1(); F = 10; b = Color.Purple; break;                 //

                case 11: f = new T2(); F = 11; b = Color.Purple; break;                 //

                case 12: f = new T3(); F = 12; b = Color.Purple; break;                 //

                case 13: f = new T4(); F = 13; b = Color.Purple; break;                 //

                case 14: f = new El5(); F = 14; b = Color.Blue; break;                  //

                case 15: f = new El6(); F = 15; b = Color.Blue; break;                  //

                case 16: f = new El7(); F = 16; b = Color.Blue; break;                  //

                case 17: f = new El8(); F = 17; b = Color.Blue; break;                  //

                case 18: f = new Cetvorka3(); F = 18; b = Color.Red; break;             //

                case 19: f = new Cetvorka4(); F = 19; b = Color.Red; break;             //
                }

                q = 0;
                if (F == 3)
                {
                    provera_pri_kreiranju_elementa(9, 12);
                }
                else if ((F == 1) || (F == 6) || (F == 8) || (F == 9) || (F == 10) || (F == 12) || (F == 15) || (F == 17) || (F == 19))
                {
                    provera_pri_kreiranju_elementa(28, 32);
                }
                else if ((F == 2) || (F == 4) || (F == 7) || (F == 11) || (F == 13) || (F == 14) || (F == 16) || (F == 18))
                {
                    provera_pri_kreiranju_elementa(49, 51);
                }
                else if (F == 5)
                {
                    provera_pri_kreiranju_elementa(70, 71);
                }

                if (q != 1)
                {
                    oboji(b);
                    timer1.Start();
                }
                else
                {
                    for (int y = 1; y < 481; y++)
                    {
                        Controls["panel" + y].BackColor = Color.White;
                    }
                    label1.Enabled = true;
                }
            }
        }