public override void Add(Control value) { TabPage page = value as TabPage; if (page == null) { throw new ArgumentException("Cannot add " + value.GetType().Name + " to TabControl. " + "Only TabPages can be directly added to TabControls."); } page.SetVisible(false); base.Add(value); owner.m_helper.Add(page); if (owner.TabCount == 1 && owner.selected_index < 0) { owner.SelectedIndex = 0; } owner.Redraw(); }