Let's Go!First off let's create a form in VB and call it whatever you want
Go to solution explorer and change the Form1 name to
Main.
Add reference to TWBP and Awesomium (If not done already)
Main:Add the TWBP Tabcontrol to Main and add this code in your Main_Load:
TwbpTabs1.TabCloseButtonImage = My.Resources.close_Tab_0
TwbpTabs1.TabCloseButtonImage_Over = My.Resources.close_Tab_1
TwbpTabs1.TabCloseButtonImage_Pressed = My.Resources.close_Tab_0
TwbpTabs1.TabBarBorderColour = New ColinVerhey.TWBP.TWBPColour("#000000")
TwbpTabs1.TabBarTopColour = New ColinVerhey.TWBP.TWBPColour("#ffffff")
TwbpTabs1.TabBarBottomColour = New ColinVerhey.TWBP.TWBPColour("#ffffff")
TwbpTabs1.TabTopColour = New ColinVerhey.TWBP.TWBPColour(My.Settings.tabtop)
TwbpTabs1.TabBottomColour = New ColinVerhey.TWBP.TWBPColour(My.Settings.tabbottom)
TwbpTabs1.bgTabTopColour = New ColinVerhey.TWBP.TWBPColour("#f8f8f8")
TwbpTabs1.bgTabBottomColour = New ColinVerhey.TWBP.TWBPColour("#f8f8f8")
TwbpTabs1.TabContainer.AddTab(New webbrowserform, True, TwbpTabs1.TabContainer.TabCount)
You should get errors for the My.Resource.close_Tab_#, so add the images attached in this article.
Our next step is to create a new form called
webbrowserform, this is where everything will be. Your webbrowser should now have no errors
Webbrowserform:Let's add a panel and dock it to the top, the height is 27px. name it
toolsWe are going to add another panel and make it fill the rest of the webbrowserform, anchor it to all four anchors (left,up,down,right). Name it
webpholderAdd a WebControl to the webpholder and dock it to fill. Name the Webcontrol to
webAdd 4 buttons and set there FlatStyle to
FLAT. Tweak the settings to change their colours and add images to them. Add images and in this order name the 4 buttons: Back, Forward, Refresh and Home. Make sure you have put them straight to the left... eg:
[⬅️] [➡️] [🔄] [🏠] Go to the back_click code and add this:
If web.CanGoBack Then
web.GoBack()
End If
In the Forward_click:
If web.CanGoForward Then
web.GoForward()
End If
Refresh:
web.Source = web.Source
Home:
web.Source = My.Settings.home
Let's quickly go to settings and add a setting called 'Home' and 'Search' and change both types to (Web Service URL)
Set home to
www.google.com/and the Search to
www.google.com/search?q=Add a button and put it to the right. This is your settings button.
Your tools should look like this:
[⬅️] [➡️] [🔄] [🏠] [⚙]Add a TextBox to the tools and make it fill the rest of the blank space. Call it Search
[⬅️] [➡️] [🔄] [🏠][ TextBox ][⚙]
Now let's add code to the last two items. Add this to your textbox key_down
Private Sub search_KeyDown(sender As Object, e As KeyEventArgs) Handles search.KeyDown
search.SelectionColor = Color.Black
If e.KeyCode = Keys.Enter Then
If search.Text.Contains(".") & ("") Then
Try
web.Source = New Uri(search.Text)
Catch ex As UriFormatException
web.Source = New Uri("http://www." & search.Text)
web.Source = New Uri("http://" & search.Text)
End Try
Else
web.Source = New Uri(My.Settings.search & search.Text)
End If
End If
End Sub
and your Settings button_click:
Settings.show
Now we should have a functioning webbrowser!
Settings:Let's add a new form called Settings
Add 2 labels, one ontop of each other and change the text to 'Home:' and 'Search:', make the names of them Home and Search
Add 2 Textbox's and place them next to each label. It should look like this:
Home: [ TextBox ]
Search: [ TextBox ]
Add a button and call it apply.
It should now look like this:
Home: [ TextBox ]
Search: [ TextBox ]
[Apply]
In the Apply button_click code write this:
My.Settings.home = Home.Text
My.Settings.search = Search.text
This is all I'm going to do for now, the source will come soon and so will screenshots. For now try to follow my horrible attempt at text pictures
Anyway, sign up to this forum and comment what else you'll like to see in this article and I'll try to change it!
If there is anything else you'd like to add to your webbrowser, search this forum. It has
TONNES of webbrowser questions!
Thanks,
Aeolus
Images (Close Buttons):
(Close_Button_0)
(Close_Button_1)