The first element will not be at position 0, because at the time of calculating the location, the new element is not added to the panel elements. In addition, you should use AutoScrollPosition to align positions. Here is my suggestion:
int pos = (Container.AutoScrollPosition.Y != 0 ? Container.AutoScrollPosition.Y - newitem.Height : 0); if (Container.Controls.Count > 0) { foreach (Control c in Container.Controls) { c.Location = new Point(0, pos); pos += c.Height; } } } newitem.Location = new Point(0, pos); Container.Controls.Add(newitem);
source share