private void загрузитьФайлToolStripMenuItem_Click(object sender, EventArgs e) { string[] lines = System.IO.File.ReadAllLines(@"E:\dev\save.txt"); for (int i = 1; i < Int32.Parse(lines[0]) + 1; ++i) { string [] split = lines[i].Split(new Char [] { ' ', ',', '.', ':', '\t' }); RectObj r = new RectObj(); r.Rect = new Rectangle(Int32.Parse(split.ElementAt(0)), Int32.Parse(split.ElementAt(1)), Int32.Parse(split.ElementAt(2)), Int32.Parse(split.ElementAt(3))); r.IsClicked = false; rectList.Add(r); } for (int i = Int32.Parse(lines[0]) + 2; i < Int32.Parse(lines[0]) + Int32.Parse(lines[Int32.Parse(lines[0]) + 1]) + 1; ++i) { string[] split = lines[i].Split(new Char[] { ' ', ',', '.', ':', '\t' }); Point p1 = new Point(Int32.Parse(split[0]), Int32.Parse(split[1])); Point p2 = new Point(Int32.Parse(split[2]), Int32.Parse(split[3])); Point p3 = new Point(Int32.Parse(split[4]), Int32.Parse(split[5])); p1List.Add(p1); p2List.Add(p2); rectPointList.Add(p3); } pictureBox1.Invalidate(); }
void add_Item(object sender, EventArgs e) { RectObj r = new RectObj(); r.Rect = new Rectangle(100, 100, 200, 100); r.IsClicked = false; locEditForm.txtLocContent.Text = ""; locEditForm.txtShtLocDescription.Text = ""; locEditForm.txtLocName.Text = ""; if (locEditForm.ShowDialog() == DialogResult.OK) { r.ShtLocDescription = locEditForm.txtShtLocDescription.Text; r.LocName = locEditForm.txtLocName.Text; pictureBox1.Invalidate(); } rectList.Add(r); pictureBox1.Invalidate(); }