//private List<Tblock>Listp; public Form2(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"); 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); }
public Form3(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 + 2, -1); Controls.Add(butterfly); butterfly.Ball.BringToFront(); Controls.Add(butterfly.Ball); for (int i = 0; i < 3; i++) { Controls.Add(butterfly.ball[i]); } //-------------------------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]); } //-------------------------------------------------------------------------------------------------------------------------- button2.Left = button3.Left = cv.left_pg + culmn * cv.width_pic + 50; button2.Top = button3.Top = cv.top_pg; //System.Media.SoundPlayer myPlayer = new System.Media.SoundPlayer(); //myPlayer.SoundLocation = @"f:\New Folder\SoundS\GameplayMusic.wav"; //myPlayer.PlayLooping(); }