/// <summary>
 /// Overridden. Inherited from <see cref="ControlDesigner.Initialize( IComponent )"/>.
 /// </summary>
 /// <param name="component">
 /// The <see cref="IComponent"/> hosted by the designer.
 /// </param>
 public override void Initialize(IComponent component)
 {
     userTabPage = component as UserTabPage;
     if (userTabPage == null)
     {
         DisplayError(new Exception("You attempted to use a UserTabPageDesigner with a class that does not inherit from UserTabPage."));
     }
     base.Initialize(component);
 }
 /// <summary>
 /// Overridden. Inherited from <see cref="Control"/>.
 /// </summary>
 /// <param name="cea">
 /// See <see cref="Control.OnControlRemoved(ControlEventArgs)"/>.
 /// </param>
 protected override void OnControlRemoved(ControlEventArgs cea)
 {
     cea.Control.TextChanged -= ChildTextChangeEventHandler;
     base.OnControlRemoved(cea);
     if (Controls.Count > 0)
     {
         selectedIndex = 0;
         selectedTab.Visible = false;
         selectedTab = (UserTabPage)Controls[0];
         selectedTab.Visible = true;
     }
     else
     {
         selectedIndex = -1;
         selectedTab = null;
     }
     CalculateTabLengths();
     CalculateLastVisibleTabIndex();
     InU();
 }
 /// <summary>
 /// Overridden. Inherited from <see cref="Control"/>.
 /// </summary>
 /// <param name="cea">
 /// See <see cref="Control.OnControlAdded(ControlEventArgs)"/>.
 /// </param>
 protected override void OnControlAdded(ControlEventArgs cea)
 {
     base.OnControlAdded(cea);
     cea.Control.Visible = false;
     if (selectedIndex == -1)
     {
         selectedIndex = 0;
         selectedTab = (UserTabPage)cea.Control;
         selectedTab.Visible = true;
     }
     cea.Control.TextChanged += ChildTextChangeEventHandler;
     CalculateTabLengths();
     CalculateLastVisibleTabIndex();
     InU();
 }