Example #1
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);
        }
Example #2
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]);
            }

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