A page in a DropDownTabControl.
Inheritance: System.Windows.Forms.Panel
        /// <summary>
        /// Handles the <see cref="TabPageCollection.TabPageRemoved"/> event of this
        /// control's collection of <see cref="DropDownTabPage"/>s.
        /// </summary>
        /// <remarks>
        /// This unwires the tab page from the control, and removes it to the <see cref="UI.Controls"/>
        /// collection.
        /// </remarks>
        /// <param name="sender">The object that raised the event.</param>
        /// <param name="e">A <see cref="DropDownTabControl.TabPageEventArgs"/> describing the event arguments.</param>
        private void RemoveTabPage(object sender, DropDownTabControl.TabPageEventArgs e)
        {
            DropDownTabPage ctlPage = e.TabPage;

            ctlPage.PageIndexChanged -= new EventHandler(PageIndexChanged);
            ctlPage.TextChanged      -= new EventHandler(PageTextChanged);
            m_cbxSelector.Items.Remove(ctlPage);
            for (Int32 i = 0; i < m_tpcPages.Count; i++)
            {
                if (m_tpcPages[i].PageIndex > ctlPage.PageIndex)
                {
                    m_tpcPages[i].PageIndex--;
                }
            }
            if (SelectedTabPage == ctlPage)
            {
                if (m_tpcPages.Count == 0)
                {
                    SelectedTabPage = null;
                }
                else if (SelectedIndex == m_tpcPages.Count)
                {
                    SelectedIndex--;
                }
                else
                {
                    SelectedIndex++;
                }
            }
            Controls.Remove(e.TabPage);
        }
 /// <summary>
 /// Raises the <see cref="Control.ControlAdded"/> event.
 /// </summary>
 /// <remarks>
 /// This ensures that any <see cref="DropDownTabPage"/>s removed from this control are removed
 /// from the <see cref="TabPages"/> collection.
 /// </remarks>
 /// <param name="e">A <see cref="ControlEventArgs"/> describing the event arguments.</param>
 protected override void OnControlRemoved(ControlEventArgs e)
 {
     base.OnControlRemoved(e);
     if (e.Control is DropDownTabPage)
     {
         DropDownTabPage ctlPage = (DropDownTabPage)e.Control;
         m_tpcPages.Remove(ctlPage);
     }
 }
        /// <summary>
        /// Creates an instance of an item for use in the collection being edited.
        /// </summary>
        /// <remarks>
        /// This sets the text of the created <see cref="DropDownTabPage"/> to its
        /// name.
        /// </remarks>
        /// <param name="p_tpeItemType">The type of the item to be created.</param>
        /// <returns>A new object of the given type.</returns>
        protected override object CreateInstance(Type p_tpeItemType)
        {
            object          objNew  = base.CreateInstance(p_tpeItemType);
            DropDownTabPage dtpPage = objNew as DropDownTabPage;

            if (dtpPage != null)
            {
                dtpPage.Text = dtpPage.Name;
            }
            return(objNew);
        }
 /// <summary>
 /// Raises the <see cref="Control.ControlAdded"/> event.
 /// </summary>
 /// <remarks>
 /// This ensures that any <see cref="DropDownTabPage"/>s added to this control are added
 /// from the <see cref="TabPages"/> collection.
 /// </remarks>
 /// <param name="e">A <see cref="ControlEventArgs"/> describing the event arguments.</param>
 protected override void OnControlAdded(ControlEventArgs e)
 {
     base.OnControlAdded(e);
     if (e.Control is DropDownTabPage)
     {
         DropDownTabPage ctlPage = (DropDownTabPage)e.Control;
         if (!m_tpcPages.Contains(ctlPage))
         {
             m_tpcPages.Add(ctlPage);
         }
     }
 }
        /// <summary>
        /// Inserts the given <see cref="DropDownTabPage"/> into the selector drop box at the correct index based on the
        /// tab's <see cref="DropDownTabPage.PageIndex"/>.
        /// </summary>
        /// <param name="p_ddpPage">The <see cref="DropDownTabPage"/> to insert.</param>
        protected void InsertTabPageInSelector(DropDownTabPage p_ddpPage)
        {
            DropDownTabPage ddpCurrent = null;

            for (Int32 i = 0; i < m_cbxSelector.Items.Count; i++)
            {
                ddpCurrent = (DropDownTabPage)m_cbxSelector.Items[i];
                if (ddpCurrent.PageIndex > p_ddpPage.PageIndex)
                {
                    m_cbxSelector.Items.Insert(i, p_ddpPage);
                    return;
                }
            }
            m_cbxSelector.Items.Add(p_ddpPage);
        }
        /// <summary>
        /// Adds default tag pages to a new <see cref="DropDownTabControl"/>.
        /// </summary>
        /// <param name="defaultValues">The values with which to instantiate the control.</param>
        public override void InitializeNewComponent(IDictionary defaultValues)
        {
            base.InitializeNewComponent(defaultValues);

            DropDownTabPage tpgPage = (DropDownTabPage)DesignerHost.CreateComponent(typeof(DropDownTabPage));

            tpgPage.Text      = tpgPage.Name;
            tpgPage.BackColor = Color.FromKnownColor(KnownColor.Control);
            DesignedTabControl.TabPages.Add(tpgPage);

            tpgPage           = (DropDownTabPage)DesignerHost.CreateComponent(typeof(DropDownTabPage));
            tpgPage.Text      = tpgPage.Name;
            tpgPage.BackColor = Color.FromKnownColor(KnownColor.Control);
            DesignedTabControl.TabPages.Add(tpgPage);

            DesignedTabControl.SelectedIndex = 0;
        }
        /// <summary>
        /// The event handler for the "Add Tab Page" verb.
        /// </summary>
        /// <remarks>
        /// Adds a new tab page to the control.
        /// </remarks>
        /// <param name="sender">The object that triggered the event.</param>
        /// <param name="e">An <see cref="EventArgs"/> describing the event arguments.</param>
        private void AddTabPage(object sender, EventArgs e)
        {
            DropDownTabControl.TabPageCollection tpcOldPages = DesignedTabControl.TabPages;

            RaiseComponentChanging(TypeDescriptor.GetProperties(DesignedTabControl)["TabPages"]);

            DropDownTabPage tpgPage = (DropDownTabPage)DesignerHost.CreateComponent(typeof(DropDownTabPage));

            tpgPage.Text      = tpgPage.Name;
            tpgPage.BackColor = Color.FromKnownColor(KnownColor.Control);
            DesignedTabControl.TabPages.Add(tpgPage);

            RaiseComponentChanged(TypeDescriptor.GetProperties(DesignedTabControl)["TabPages"], tpcOldPages, DesignedTabControl.TabPages);

            DesignedTabControl.SelectedTabPage = tpgPage;
            EnableVerbs();
        }
        /// <summary>
        /// Handles the <see cref="TabPageCollection.TabPageAdded"/> event of this
        /// control's collection of <see cref="DropDownTabPage"/>s.
        /// </summary>
        /// <remarks>
        /// This wires the added tab page into the control, and adds it to the <see cref="UI.Controls"/>
        /// collection.
        /// </remarks>
        /// <param name="sender">The object that raised the event.</param>
        /// <param name="e">A <see cref="DropDownTabControl.TabPageEventArgs"/> describing the event arguments.</param>
        private void AddTabPage(object sender, DropDownTabControl.TabPageEventArgs e)
        {
            DropDownTabPage ctlPage = e.TabPage;

            if (ctlPage.PageIndex == -1)
            {
                ctlPage.PageIndex = m_tpcPages.Count - 1;
            }
            if (!m_tpcPages.Contains(ctlPage))
            {
                m_tpcPages.Add(ctlPage);
            }
            ctlPage.PageIndexChanged += new EventHandler(PageIndexChanged);
            ctlPage.TextChanged      += new EventHandler(PageTextChanged);
            InsertTabPageInSelector(ctlPage);
            ctlPage.Dock = DockStyle.Fill;
            Controls.Add(e.TabPage);
            SelectedTabPage = ctlPage;
        }
 /// <summary>
 /// A simple consturctor that initializes the object with the given values.
 /// </summary>
 /// <param name="p_tpgPage">The tab page that was affected by the event.</param>
 public TabPageEventArgs(DropDownTabPage p_tpgPage)
 {
     m_tpgPage = p_tpgPage;
 }