コード例 #1
0
 /// <summary>
 /// Sets the collection to the set of given items.
 /// </summary>
 /// <param name="p_objTabPages">The collection being edited.</param>
 /// <param name="p_objValues">The array of items to which to set the collection being edited.</param>
 /// <returns>The resulting collection with the new items.</returns>
 protected override object SetItems(object p_objTabPages, object[] p_objValues)
 {
     VerticalTabControl.TabPageCollection tpcPages = (VerticalTabControl.TabPageCollection)base.SetItems(p_objTabPages, p_objValues);
     for (Int32 i = 0; i < tpcPages.Count; i++)
     {
         tpcPages[i].PageIndex = i;
     }
     return(tpcPages);
 }
コード例 #2
0
        /// <summary>
        /// The event handler for the "Remove Tab Page" verb.
        /// </summary>
        /// <remarks>
        /// Removes the current tab page from 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 RemoveTabPage(object sender, EventArgs e)
        {
            if (DesignedTabControl.SelectedIndex < 0)
            {
                return;
            }

            VerticalTabControl.TabPageCollection tpcOldPages = DesignedTabControl.TabPages;

            RaiseComponentChanging(TypeDescriptor.GetProperties(DesignedTabControl)["TabPages"]);
            DesignerHost.DestroyComponent((VerticalTabPage)(DesignedTabControl.TabPages[DesignedTabControl.SelectedIndex]));
            RaiseComponentChanged(TypeDescriptor.GetProperties(DesignedTabControl)["TabPages"], tpcOldPages, DesignedTabControl.TabPages);

            SelectionService.SetSelectedComponents(new IComponent[] { DesignedTabControl }, SelectionTypes.Auto);
            EnableVerbs();
        }
コード例 #3
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)
        {
            VerticalTabControl.TabPageCollection tpcOldPages = DesignedTabControl.TabPages;

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

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

            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();
        }