public void SetChannelList(List<ChannelModel> channelList) { int i = 0; foreach (var itemModel in channelList) { ChannelTag ItemUI = new ChannelTag(this, itemModel); ItemList.Add(ItemUI); ItemUI.Dock = System.Windows.Forms.DockStyle.Fill; ItemUI.Name = "ItemUI" + (i.ToString()); this.tlp_ChannelList.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 30F)); this.tlp_ChannelList.Controls.Add(ItemUI, 0, i); i++; ItemUI.TabIndex = i; Current = ItemUI; } }
public void RemoveItem() { this.ItemList.Remove(this.Current); this.tlp_ChannelList.Controls.Remove(this.Current); this.Current = (ChannelTag)this.tlp_ChannelList.Controls[this.tlp_ChannelList.Controls.Count]; }