private void toolStripAddPerson_Click(object sender, EventArgs e) { Guid novaOsobaGuid = tree.AddPerson("Nova", "Osoba"); Person p = tree.GetPersonByID(novaOsobaGuid); PersonControl c = new PersonControl(p, this); c.setLocation(newLocationInGraph()); graf.Controls.Add(c); controls.Add(p,c); }
public void RefreshTree() { graf.Controls.Clear(); controls.Clear(); foreach (Person p in tree.osobe) { PersonControl c = new PersonControl(p, this); // ako je osoba dodana iz konzole, koordinate nisu dobro postavljene i iznose 0,0. Bolje rjesenje: promjena strukture da stavlja -1,-1 if (p.positionX == 0 && p.positionY == 0) c.setLocation(newLocationInGraph()); else c.setLocation(R2A(new Point(p.positionX, p.positionY))); splitC.Panel1.Controls.Add(c); controls.Add(p,c); } graf.Invalidate(); redrawConnections(); }