public override void Add(Control value) { if (!(value is TabPage)) { throw new ArgumentException(string.Format(SR.TabControlInvalidTabPageType, value.GetType().Name)); } TabPage tabPage = (TabPage)value; // See InsertingItem property if (!_owner.InsertingItem) { if (_owner.IsHandleCreated) { _owner.AddTabPage(tabPage); } else { _owner.Insert(_owner.TabCount, tabPage); } } base.Add(tabPage); tabPage.Visible = false; // Without this check, we force handle creation on the tabcontrol // which is not good at all of there are any OCXs on it. if (_owner.IsHandleCreated) { tabPage.Bounds = _owner.DisplayRectangle; } // Site the tabPage if necessary. ISite site = _owner.Site; if (site != null) { ISite siteTab = tabPage.Site; if (siteTab == null) { site.Container?.Add(tabPage); } } _owner.ApplyItemSize(); _owner.UpdateTabSelection(false); }