Exemple #1
0
        public Ghab(int r, int c)
        {
            sizeghab = (c + r + 2) * 2;
            ghab     = new Tblock[sizeghab];
            for (int i = 0; i < sizeghab; i++)
            {
                if (i <= c + 1)
                {
                    ghab[i] = new Tblock(-1, i - 1);
                }

                if (c + 1 < i && i <= c + r + 2)
                {
                    ghab[i] = new Tblock(i - (c + 2), c);
                }

                if (c + r + 2 < i && i <= 2 * (c) + 3 + r)
                {
                    ghab[i] = new Tblock(r, c - (i - (r + c + 2)));
                }

                if (2 * c + 3 + r < i)
                {
                    ghab[i] = new Tblock(r - (i - (r + 2 * c + 3)), -1);
                }

                ghab[i].Image = System.Drawing.Image.FromFile(Directory.GetCurrentDirectory() + @"\pictures" + @"\" + "G9.jpg");
            }
        }
Exemple #2
0
 public void makeTmap(int r, int c)
 {
     row   = r; coulmn = c;
     block = new Tblock[row, coulmn];
     for (int i = 0; i < row; i++)
     {
         for (int j = 0; j < coulmn; j++)
         {
             block[i, j] = new Tblock(i, j);
         }
     }
 }
Exemple #3
0
        //private List<Tblock>Listp;

        public Form3(int r, int c)
        {
            InitializeComponent();
            row   = r;
            culmn = c;
            cv    = new Constvar();

            widtht_pg = cv.width_pic * culmn;
            hight_pg  = cv.hight_pic * row;

            map = new Tmap();
            map.makeTmap(row, culmn);
            for (int i = 0; i < row; i++)
            {
                for (int j = 0; j < culmn; j++)
                {
                    Controls.Add(map.block[i, j]); map.block[i, j].Visible = false;
                }
            }


            butterfly           = new Tblock(0, 0);
            butterfly.BackColor = SystemColors.Control;
            Controls.Add(butterfly);
            butterfly.Image = Image.FromFile(Directory.GetCurrentDirectory() + @"\pictures" + @"\" + "butterfly[1].gif");

            Pview        = new Tblock(0, 0);
            Pview.Width  = widtht_pg;
            Pview.Height = hight_pg;
            //Pview.Image = Image.FromFile(Directory.GetCurrentDirectory() + @"\pictures" + @"\" + "g1.jpg");
            Pview.BackColor = Color.Black;
            Controls.Add(Pview);

            gh = new Ghab(row, culmn);
            for (int i = 0; i < gh.sizeghab; i++)
            {
                Controls.Add(gh.ghab[i]);
            }

            map.lp = new List <Tpoint>();
            Tpoint start = new Tpoint(0, 0);

            map.lp.Add(start);
        }
Exemple #4
0
        public Form4(string st)
        {
            InitializeComponent();

            //-------------------------load path-----------------------------------------------------------------------------------------------
            Tpoint point = new Tpoint();

            map = new Tmap();
            Read_file rf = new Read_file(ref map.lp, st, ref point);

            row   = point.r;
            culmn = point.c;

            //-------------------------make map-----------------------------------------------------------------------------------------------
            map.makeTmap(row, culmn);
            for (int i = 0; i < row; i++)
            {
                for (int j = 0; j < culmn; j++)
                {
                    Controls.Add(map.block[i, j]); map.block[i, j].Visible = false;
                }
            }
            int c = 0;

            while (c != map.lp.Count)
            {
                map.block[map.lp[c].r, map.lp[c].c].Image   = Image.FromFile(Directory.GetCurrentDirectory() + @"\pictures" + @"\" + "1.jpg");
                map.block[map.lp[c].r, map.lp[c].c].Visible = true;
                c++;
            }

            //------------------------------------------------------------------------------------------------------------------------------
            cv        = new Constvar();
            widtht_pg = cv.width_pic * culmn;
            hight_pg  = cv.hight_pic * row;

            Width  = widtht_pg + 300;
            Height = hight_pg + 300;

            //-------------------------make Butterfky-----------------------------------------------------------------------------------------------
            butterfly = new Tbutterfly(row, culmn, row + 1, -1);
            Controls.Add(butterfly);
            butterfly.ball[0].BringToFront();
            Controls.Add(butterfly.ball[0]);

            //-------------------------make view-----------------------------------------------------------------------------------------------
            Pview           = new Tblock(0, 0);
            Pview.Width     = widtht_pg;
            Pview.Height    = hight_pg;
            Pview.Image     = Image.FromFile(Directory.GetCurrentDirectory() + @"\pictures" + @"\" + "Score.jpg");
            Pview.BackColor = Color.Black;
            Controls.Add(Pview);
            //-------------------------make ghab-----------------------------------------------------------------------------------------------

            gh = new Ghab(row, culmn);
            for (int i = 0; i < gh.sizeghab; i++)
            {
                Controls.Add(gh.ghab[i]);
            }

            //--------------------------------------------------------------------------------------------------------------------------
        }