Torna al Thread

Public Class Form1 Public WithEvents SWB As Skybound.Gecko.GeckoWebBrowser Public Sub AddTab(ByRef URL As String, ByRef BrowserTab As TabControl) ' Inanzitutto, creiamo una tab Dim _tab As New TabPage("Nuova Scheda") ' Adesso, creiamo un webbrowser Dim _wb As New Skybound.Gecko.GeckoWebBrowser ' Qui ti basterà sostituire WebBrowser con Skybound.Gecko.GeckoWebBrowser ecc ecc ' Se vuoi, puoi decidere di farlo già andare da qualche parte _wb.Navigate("http://www.google.it") ' Adesso, facciamo in modo che il webbrowser prenda tutta la tab _wb.Dock = DockStyle.Fill ' Adesso possiamo inserirlo nella tab _tab.Controls.Add(_wb) ' E infine, inseriamo la tab con il webbrowser nel tabcontrol TabControl1.Controls.Add(_tab) ' Poi, opzionale, dai il focus alla nuova tab creata TabControl1.SelectedTab = _tab End Sub Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load End Sub Private Sub ToolStripButton1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton1.Click Dim SWB As Skybound.Gecko.GeckoWebBrowser = Me.TabControl1.SelectedTab.Tag SWB.GoBack() End Sub Private Sub ToolStripButton2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton2.Click Dim SWB As Skybound.Gecko.GeckoWebBrowser = Me.TabControl1.SelectedTab.Tag SWB.GoForward() End Sub Private Sub ToolStripButton3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton3.Click Dim SWB As Skybound.Gecko.GeckoWebBrowser = Me.TabControl1.SelectedTab.Tag SWB.Refresh() End Sub Private Sub ToolStripButton4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton4.Click Dim SWB As Skybound.Gecko.GeckoWebBrowser = Me.TabControl1.SelectedTab.Tag SWB.Stop() End Sub Private Sub ToolStripButton5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton5.Click Dim SWB As Skybound.Gecko.GeckoWebBrowser = Me.TabControl1.SelectedTab.Tag SWB.Navigate(ToolStripTextBox1.Text) End Sub Private Sub ToolStripButton6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton6.Click Dim SWB As Skybound.Gecko.GeckoWebBrowser = TabControl1.SelectedTab.Tag SWB.Navigate("http://www.google.it") End Sub Private Sub ToolStripButton7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton7.Click Dim SWB As Skybound.Gecko.GeckoWebBrowser = Me.TabControl1.SelectedTab.Tag SWB.Navigate("http://www.google.com/search?sourceid=Webkit=UTF-8&q=" + ToolStripTextBox2.Text) End Sub Private Sub NewTabToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NewTabToolStripMenuItem.Click AddTab("http://www.google.it", TabControl1) End Sub Private Sub NewWindowToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NewWindowToolStripMenuItem.Click Dim NFRM As New Form1 NFRM.Show() End Sub Private Sub OpenToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OpenToolStripMenuItem.Click Dim open As New OpenFileDialog If open.ShowDialog = Windows.Forms.DialogResult.OK Then Dim SWB As Skybound.Gecko.GeckoWebBrowser = Me.TabControl1.SelectedTab.Tag SWB.Navigate(open.FileName) End If End Sub Private Sub PrintToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) End Sub Private Sub PagePreviewToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) End Sub Private Sub PageSetupToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) End Sub Private Sub ExitToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitToolStripMenuItem.Click End Sub Private Sub ExitToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitToolStripMenuItem1.Click End End Sub Private Sub RemoveTabToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RemoveTabToolStripMenuItem.Click If TabControl1.TabPages.Count = 1 Then Me.Close() Else TabControl1.TabPages.Remove(TabControl1.SelectedTab) End If End Sub Private Sub ExitAllWindowsToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitAllWindowsToolStripMenuItem.Click Application.Exit() End Sub Private Sub RestartToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RestartToolStripMenuItem.Click Application.Restart() End Sub Private Sub TabControl1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TabControl1.SelectedIndexChanged Try Dim SWB As Skybound.Gecko.GeckoWebBrowser = Me.TabControl1.SelectedTab.Tag ToolStripTextBox1.Text = SWB.Url.AbsoluteUri Catch ex As Exception End Try End Sub Private Sub ToolStripTextBox1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripTextBox1.Click End Sub Private Sub ToolStripTextBox1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles ToolStripTextBox1.KeyDown If e.KeyCode = Keys.Enter Then Dim SWB As Skybound.Gecko.GeckoWebBrowser = Me.TabControl1.SelectedTab.Tag SWB.Navigate(ToolStripTextBox1.Text) End If End Sub Private Sub ToolStripTextBox2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripTextBox2.Click End Sub Private Sub ToolStripTextBox2_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles ToolStripTextBox2.KeyDown If e.KeyCode = Keys.Enter Then Dim SWB As Skybound.Gecko.GeckoWebBrowser = Me.TabControl1.SelectedTab.Tag SWB.Navigate("http://www.google.com/search?sourceid=Webkit=UTF-8&q=" + ToolStripTextBox2.Text) End If End Sub End Class Public Class Tabbed_gecko_browser Inherits Skybound.Gecko.GeckoWebBrowser Private Sub Tabbed_gecko_browser_DocumentCompleted(ByVal sender As Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles Me.DocumentCompleted Form1.Text = "Fulmix Browser - " + Me.DocumentTitle Dim TB As TabPage = Me.Tag If Me.DocumentTitle.Length > 15 Then TB.Text = Me.DocumentTitle.Substring(0, 14) & "..." Else TB.Text = Me.DocumentTitle End If End Sub End Class
Copyright © dotNetHell.it 2002-2025
Running on Windows Server 2008 R2 Standard, SQL Server 2012 & ASP.NET 3.5