public AccordionButton Add(string itemText, Control container) { int visibleItems = 0; for (int i = 0; i < Controls.Count; i++) { if (Controls[i].Visible) { visibleItems++; } } AccordionButton itemButton = new AccordionButton(this); itemButton.Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top; itemButton.Location = new Point(0, visibleItems * (ItemHeight + ItemSpace)); itemButton.Width = Width; itemButton.Text = itemText; container.Visible = false; Controls.Add(itemButton); Controls.Add(container); Refresh(); return(itemButton); }
public AccordionButton Add(string itemText, Control container) { int visibleItems = 0; for (int i = 0; i < Controls.Count; i++) if (Controls[i].Visible) visibleItems++; AccordionButton itemButton = new AccordionButton(this); itemButton.Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top; itemButton.Location = new Point(0, visibleItems * (ItemHeight + ItemSpace)); itemButton.Width = Width; itemButton.Text = itemText; container.Visible = false; Controls.Add(itemButton); Controls.Add(container); Refresh(); return itemButton; }