private void RefreshTabs() { // bugfix for tab removal, RemoveAt fails sometimes tabControl1.TabPages.Clear(); tabControl1.TabPages.Add(tabPage1); IList <RadioChannelGroup> groups = RadioChannelGroup.ListAll(); foreach (RadioChannelGroup group in groups) { TabPage page = new TabPage(group.GroupName); page.SuspendLayout(); ChannelsInRadioGroupControl channelsInRadioGroupControl = new ChannelsInRadioGroupControl(); channelsInRadioGroupControl.Location = new System.Drawing.Point(9, 9); channelsInRadioGroupControl.Anchor = ((AnchorStyles.Top | AnchorStyles.Bottom) | AnchorStyles.Left) | AnchorStyles.Right; page.Controls.Add(channelsInRadioGroupControl); page.Tag = group; page.Location = new System.Drawing.Point(4, 22); page.Padding = new Padding(3); page.Size = new System.Drawing.Size(457, 374); page.UseVisualStyleBackColor = true; page.PerformLayout(); page.ResumeLayout(false); tabControl1.TabPages.Add(page); } }
private void tabControl1_SelectedIndexChanged(object sender, EventArgs e) { if (_suppressRefresh) { return; } if (tabControl1.SelectedIndex == 0) { OnSectionActivated(); } else { if (tabControl1.TabCount > 0) { TabPage page = tabControl1.TabPages[tabControl1.SelectedIndex]; foreach (Control control in page.Controls) { ChannelsInRadioGroupControl groupCnt = control as ChannelsInRadioGroupControl; if (groupCnt != null) { groupCnt.Group = (RadioChannelGroup)page.Tag; groupCnt.OnActivated(); } } } } }
private void RefreshTabs() { // bugfix for tab removal, RemoveAt fails sometimes tabControl1.TabPages.Clear(); tabControl1.TabPages.Add(tabPage1); IList<RadioChannelGroup> groups = RadioChannelGroup.ListAll(); foreach (RadioChannelGroup group in groups) { TabPage page = new TabPage(group.GroupName); page.SuspendLayout(); ChannelsInRadioGroupControl channelsInRadioGroupControl = new ChannelsInRadioGroupControl(); channelsInRadioGroupControl.Location = new System.Drawing.Point(9, 9); channelsInRadioGroupControl.Anchor = ((AnchorStyles.Top | AnchorStyles.Bottom) | AnchorStyles.Left) | AnchorStyles.Right; page.Controls.Add(channelsInRadioGroupControl); page.Tag = group; page.Location = new System.Drawing.Point(4, 22); page.Padding = new Padding(3); page.Size = new System.Drawing.Size(457, 374); page.UseVisualStyleBackColor = true; page.PerformLayout(); page.ResumeLayout(false); tabControl1.TabPages.Add(page); } }