public void AddElement(string text) { var index = _elements.Count; var el = new ElementControl { Index = index, LabeledText = text, Dock = DockStyle.Top, ElementColor = ElementsColor, Height = ElementHeight }; el.ButtonClick += el_ButtonClick; panelExElementsContainer.Controls.Add(el); _elements.Add(el); SelectedIndex = index; }