Reputation: 744
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.
Upvotes: 0
Views: 479
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
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