/// <summary> /// Removes the current page. /// </summary> protected void RemovePageHandler(object sender, EventArgs e) { if (DesignerHost != null) { if (Control.Pages.Count > 1) { Page page = Control.SelectedPage; if (page != null) { int index = Control.SelectedIndex; DesignerHost.DestroyComponent(page); if (index == Control.Pages.Count) { index = Control.Pages.Count - 1; } Control.SelectedIndex = index; if (SelectionService != null) { SelectionService.SetSelectedComponents(new Component[] { Control.SelectedPage }); } } } } }
/// <summary> /// Handles the <see cref="E:RemoveTabPage" /> event. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> private void OnRemove_TabPage(object sender, System.EventArgs e) { ZeroitAyensuTab ParentControl = (ZeroitAyensuTab)this.Control; if (ParentControl.SelectedIndex < 0) { Verbs_Set(); MessageBox.Show("No TabPage selected."); return; } System.Windows.Forms.Control.ControlCollection oldTabs = ParentControl.Controls; RaiseComponentChanging(TypeDescriptor.GetProperties(ParentControl)["TabPages"]); DesignerHost.DestroyComponent(ParentControl.TabPages[ParentControl.SelectedIndex]); RaiseComponentChanged( TypeDescriptor.GetProperties(ParentControl)["TabPages"], oldTabs, ParentControl.TabPages ); SelectionService.SetSelectedComponents( new IComponent[] { ParentControl }, //System.ComponentModel.Design.SelectionTypes.Auto // .Auto is undefined System.ComponentModel.Design.SelectionTypes.Normal ); Verbs_Set(); }
private void OnRemovePage(Object sender, EventArgs e) { var parentControl = (MetroTabControl)Control; Control.ControlCollection oldTabs = parentControl.Controls; if (parentControl.SelectedIndex < 0) { return; } RaiseComponentChanging(TypeDescriptor.GetProperties(parentControl)["TabPages"]); DesignerHost.DestroyComponent(parentControl.TabPages[parentControl.SelectedIndex]); RaiseComponentChanged(TypeDescriptor.GetProperties(parentControl)["TabPages"], oldTabs, parentControl.TabPages); SelectionService.SetSelectedComponents(new IComponent[] { parentControl }, SelectionTypes.Auto); SetVerbs(); }
/// <summary> /// Handles the <see cref="E:RemovePage" /> event. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> void OnRemovePage(Object sender, EventArgs e) { MaterialTabControl ParentControl = (MaterialTabControl)Control; System.Windows.Forms.Control.ControlCollection oldTabs = ParentControl.Controls; if (ParentControl.SelectedIndex < 0) { return; } RaiseComponentChanging(TypeDescriptor.GetProperties(ParentControl)["TabPages"]); DesignerHost.DestroyComponent(ParentControl.TabPages[ParentControl.SelectedIndex]); RaiseComponentChanged(TypeDescriptor.GetProperties(ParentControl)["TabPages"], oldTabs, ParentControl.TabPages); SelectionService.SetSelectedComponents(new IComponent[] { ParentControl }, SelectionTypes.Auto); SetVerbs(); }
private void RemovePage(object sender, System.EventArgs e) { if (DesignerHost != null) { DesignerHost.DestroyComponent(TabControl.TabPages[TabControl.SelectedIndex]); TabControl.TabPages.RemoveAt(TabControl.SelectedIndex); verbRemovePage.Enabled = TabControl.TabPages.Count > 0; } }
public void RemoveTab() { if (this.KryptonTabControl.SelectedTab == null) { return; } TabPage page = this.KryptonTabControl.SelectedTab; DesignerHost.DestroyComponent(page); SelectionService.SetSelectedComponents(new IComponent[] { this.KryptonTabControl }, SelectionTypes.Auto); }
/// <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(); }
private void OnRemovePanel(Object sender, EventArgs e) { Control.ControlCollection oldManagedPanels = HostControl.Controls; if (HostControl.SelectedIndex < 0) { return; } RaiseComponentChanging(TypeDescriptor.GetProperties(HostControl)["TabPages"]); DesignerHost.DestroyComponent((Controls.ManagedPanel)HostControl.ManagedPanels[HostControl.SelectedIndex]); RaiseComponentChanged(TypeDescriptor.GetProperties(HostControl)["ManagedPanels"], oldManagedPanels, HostControl.ManagedPanels); //SelectionService.SetSelectedComponents(new IComponent[] {HostControl}, SelectionTypes.Normal); SetVerbs(); }
private void OnRemovePage(object sender, EventArgs e) { VisualTabControl _parentalControl = (VisualTabControl)Control; Control.ControlCollection _controlCollection = _parentalControl.Controls; if (_parentalControl.SelectedIndex < 0) { return; } RaiseComponentChanging(TypeDescriptor.GetProperties(_parentalControl)["TabPages"]); DesignerHost.DestroyComponent(_parentalControl.TabPages[_parentalControl.SelectedIndex]); RaiseComponentChanged(TypeDescriptor.GetProperties(_parentalControl)["TabPages"], _controlCollection, _parentalControl.TabPages); SelectionService.SetSelectedComponents(new IComponent[] { _parentalControl }, SelectionTypes.Auto); SetVerbs(); }
/// <summary> /// Removes the current page of the designed control. /// </summary> protected void RemoveTab() { if (DesignerHost != null) { if (Control.Tabs.Count > 1) { Tab tab = Control.SelectedTab; if (tab != null) { int index = Control.SelectedIndex; DesignerHost.DestroyComponent(tab); if (index == Control.Tabs.Count) { index = Control.Tabs.Count - 1; } Control.SelectedIndex = index; } } } }