private void TabCaption_SelectedTab(object sender, EventArgs e) { TabCaption caption = (TabCaption)sender; Tab tab = FindTab(caption); if (caption.IsSelected()) { SelectTab(tab); } }
public void SelectTab(Tab tab) { TabCaption tabCaption = tab.Caption; TabCaption selectedTab = captions.GetSelectedTab(); if (selectedTab != null && !selectedTab.Equals(tabCaption)) { selectedTab.SetSelected(false); } captions.SetSelectedTab(tabCaption); if (!tabCaption.IsSelected()) { TabContent content = tab.Content; contentContainer.Controls.Remove(content); } else { TabContent content = tab.Content; contentContainer.Controls.Clear(); contentContainer.Controls.Add(content); content.Focus(); } }