private void button1_Click(object sender, EventArgs e) { StopEdit stop = new StopEdit(); if (panel1.Controls.Count > 0) { Point loc = panel1.Controls[panel1.Controls.Count - 1].Location; loc.Y += stop.Height; stop.Location = loc; } panel1.Controls.Add(stop); }
public FormRoute(Route route) { InitializeComponent(); current = route; textBox1.Text = route.Number; Point last = new Point(); foreach (Route.Stop stop in route.Stops) { StopEdit stopEdit = new StopEdit(stop) { Location = last }; panel1.Controls.Add(stopEdit); last.Y += stopEdit.Height; } }