Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
849
Add a new tab
posted

Hello,

In a UltraWinTabControl, is there a way to have a button in the tab list to create a new tab, much like we have in recent web browsers (Firefox, IE 7 and 8...) ?

Regards,

Damien

  • 37774
    Verified Answer
    posted

    Damien,

    There's nothing built into the control to handle this, but it's pretty straightforward to implement.  Basically, you should create a tab at the time you create the UltraTabControl, setting the Key/Text to "+".  Then you would handle the SelectedTabChanging event, cancelling the selection of the "+" tab and inserting a new one:

    private void ultraTabControl1_SelectedTabChanging(object sender, SelectedTabChangingEventArgs e)
    {
        if (e.Tab.Key == "+")
        {
            e.Cancel = true;
            UltraTab tab = this.ultraTabControl1.Tabs.Insert(this.ultraTabControl1.Tabs.Count - 1);
            tab.Selected = true;
        }
    }

    -Matt