public Person(pers p) { InitializeComponent(); label1.Text = p.name; label3.Text = "Роль" + p.role; label2.Text = "Появился в " + p.part.ToString() + " части"; pictureBox1.Image = p.pictureBox1.Image; }
public Filter() { string[] lines = System.IO.File.ReadAllLines("Персонажи.txt"); foreach (string str in lines) { string[] parts = str.Split(new string[] { ", " }, StringSplitOptions.None); pers pers1 = new pers(Convert.ToInt32(parts[0]), parts[1], (parts[2]), parts[3]); lydi.Add(pers1); } InitializeComponent(); int x = 0; int y = 100; for (int i = 0; i < lydi.Count; i++) { lydi[i].button2.Location = new Point(x, y); lydi[i].button2.Size = new Size(100, 40); lydi[i].button2.Text = lydi[i].name; lydi[i].button2.Click += new EventHandler(button2_Click); Controls.Add(lydi[i].button2); try { lydi[i].pictureBox1.Location = new Point(x, y + 40); lydi[i].pictureBox1.Size = new Size(100, 60); lydi[i].pictureBox1.Text = lydi[i].name; lydi[i].pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage; lydi[i].pictureBox1.Load("../../Kartinki/" + lydi[i].name + ".jpg"); Controls.Add(lydi[i].pictureBox1); } catch (Exception) { } x = x + 100; if (x + 100 > Width) { x = 0; y = y + 100; } } /* RusWords.Add("Часть", "Часть"); * RusWords.Add("Имя", "Имя"); * RusWords.Add("Роль", "Роль"); * * EnWords.Add("Часть", "Part"); * EnWords.Add("Имя", "Name"); * EnWords.Add("Роль", "Role"); */ }