/// <summary> /// Adds a new <b>VerticalTabPage</b> object to the end of the collection, /// taking the tab page's text. /// <seealso cref="Insert"/> /// <seealso cref="SetTabIndex"/> /// <seealso cref="Remove"/> /// <seealso cref="VerticalTabControl"/> /// <seealso cref="VerticalTabPage"/> /// </summary> /// <param name="text">Tab page's text.</param> /// <returns>Newly created object.</returns> public VerticalTabPage Add(string text) { VerticalTabPage tabPage = new VerticalTabPage(text); this.List.Add(tabPage); return(tabPage); }
/// <summary> /// Called before an item is removed from the collection. /// </summary> /// <param name="index">Index of the item to be removed.</param> /// <param name="value">Object to be removed.</param> protected override void OnRemove(int index, object value) { VerticalTabPage tabPage = (VerticalTabPage)value; // Remove panel and button controls from child controls of the TabControl if (this.tabControl.Contains(tabPage)) { this.tabControl.Controls.Remove(tabPage.TabButton); this.tabControl.Controls.Remove(tabPage); } }
/// <summary> /// Called after a new item is inserted into the collection. /// </summary> /// <param name="index">Index of the inserted item.</param> /// <param name="value">Object that was inserted.</param> protected override void OnInsertComplete(int index, object value) { VerticalTabPage tabPage = (VerticalTabPage)value; // Set selected item if (this.tabControl.SelectedTab == null) { this.tabControl.SelectedTab = tabPage; } // Notify control that tab pages where changed this.tabControl.OnTabPagesChanged(); }
/// <summary> /// Called after an item is removed from the collection. /// </summary> /// <param name="index">Index of the removed item.</param> /// <param name="value">Object that was removed.</param> protected override void OnRemoveComplete(int index, object value) { VerticalTabPage tabPage = (VerticalTabPage)value; // Check if selected tab page should be updated if (this.tabControl.SelectedTab == tabPage) { int newIndex = index; if (newIndex >= this.tabControl.TabPages.Count) { newIndex = this.tabControl.TabPages.Count - 1; } this.tabControl.SelectedIndex = newIndex; } // Notify control that tab pages where changed this.tabControl.OnTabPagesChanged(); }
/// <summary> /// Changes the index of the tab page in the collection. /// <seealso cref="Add"/> /// <seealso cref="Remove"/> /// <seealso cref="VerticalTabControl"/> /// <seealso cref="VerticalTabPage"/> /// </summary> /// <param name="tabPage">Tab page object.</param> /// <param name="index">New index of the tab page.</param> public void SetTabIndex(VerticalTabPage tabPage, int index) { // Check if tab page exsists in the collection if (this.List.Contains(tabPage)) { // Remove item from the list without notifications this.InnerList.Remove(tabPage); // Check insert index if (index > this.Count) { index = this.Count; } // Insert item into the list without notifications this.InnerList.Insert(index, tabPage); // Notify control that tab pages where changed this.tabControl.OnTabPagesChanged(); } }
/// <summary> /// Called before an item is inserted into the collection. /// </summary> /// <param name="index">Index where the item is being inserted.</param> /// <param name="value">Inserted object.</param> protected override void OnInsert(int index, object value) { VerticalTabPage tabPage = (VerticalTabPage)value; // Set referense to the tab control tabPage.tabControl = this.tabControl; // Set referense to the tab control image list if (this.tabControl.ImageList != null) { tabPage.TabButton.ImageList = this.tabControl.ImageList; } // Set button orientation tabPage.TabButton.Vertical = this.tabControl.Vertical; // Add panel and button controls as child controls of the TabControl if (!this.tabControl.Contains(tabPage)) { this.tabControl.Controls.Add(tabPage.TabButton); this.tabControl.Controls.Add(tabPage); } }
/// <summary> /// Removes the specified tab page from the collection. /// <seealso cref="Add"/> /// <seealso cref="Insert"/> /// <seealso cref="SetTabIndex"/> /// <seealso cref="VerticalTabControl"/> /// <seealso cref="VerticalTabPage"/> /// </summary> /// <param name="tabPage">Tab page to remove.</param> public void Remove(VerticalTabPage tabPage) { this.List.Remove(tabPage); }
/// <summary> /// Inserts a new tab page into the collection. /// <seealso cref="Add"/> /// <seealso cref="Remove"/> /// <seealso cref="SetTabIndex"/> /// <seealso cref="VerticalTabControl"/> /// <seealso cref="VerticalTabPage"/> /// </summary> /// <param name="index">Index where the tab page will be inserted.</param> /// <param name="text">Tab page's text.</param> public void Insert(int index, string text) { VerticalTabPage tabPage = new VerticalTabPage(text); this.List.Insert(index, tabPage); }
/// <summary> /// Inserts the specified <b>VerticalTabPage</b> object into the collection. /// <seealso cref="Add"/> /// <seealso cref="Remove"/> /// <seealso cref="SetTabIndex"/> /// <seealso cref="VerticalTabControl"/> /// <seealso cref="VerticalTabPage"/> /// </summary> /// <param name="index">Index where the tab page will be inserted.</param> /// <param name="tabPage">Tab page object.</param> public void Insert(int index, VerticalTabPage tabPage) { this.List.Insert(index, tabPage); }
/// <summary> /// Adds the specified <b>VerticalTabPage</b> object to the end of the collection. /// <seealso cref="Insert"/> /// <seealso cref="Remove"/> /// <seealso cref="SetTabIndex"/> /// <seealso cref="VerticalTabControl"/> /// <seealso cref="VerticalTabPage"/> /// </summary> /// <param name="tabPage">Tab page object.</param> /// <returns>Index of the added object.</returns> public int Add(VerticalTabPage tabPage) { return(this.List.Add(tabPage)); }