Raditya Kurnianto
Raditya Kurnianto

Reputation: 744

Implement new tab on web browser control for C#

I want to build my own web browser, but I'm stuck on operation for adding new tab, does anyone have any idea to make it done?

The final result will should like this.

enter image description here

Upvotes: 0

Views: 479

Answers (2)

j.s.banger
j.s.banger

Reputation: 412

you can try this:-

if (tabControl1.SelectedTab.Text == "+")
        {
            AddNewTab();
        }
        foreach (Control item in tabControl1.SelectedTab.Controls)
        {
            if (item.GetType() == typeof(WebBrowser))
            {
                WebBrowser wb = (WebBrowser)item;
                toolStripButton1.Enabled = wb.CanGoBack;
                toolStripButton2.Enabled = wb.CanGoForward;
            }
        }

Upvotes: 1

nyctef
nyctef

Reputation: 571

The way I'd go about it would be (using a TabControl or similar) to create a special tab with just the plus icon you want. Then handle the tab changed event, check if you've switched to the special tab, and if so, cancel the tab change, create a new tab and set that to be displayed instead.

Upvotes: 0

Related Questions