Neste poste você terá os códigos necessários para deixar seu browser(navegador para a internet) mais completo.
Public Class Form1
Dim int As Integer = 0
Private Sub Loading(ByVal sender As Object, ByVal e As Windows.Forms.WebBrowserProgressChangedEventArgs)
ToolStripProgressBar1.Maximum = e.MaximumProgress
ToolStripProgressBar1.Value = e.CurrentProgress
End Sub
=========================================================================
Private Sub Done(ByVal sender As Object, ByVal e As Windows.Forms.WebBrowserDocumentCompletedEventArgs)
TabControl1.SelectedTab.Text = CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).DocumentTitle
TextBox1.Text = CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).Url.ToString
ToolStripStatusLabel1.Text = CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).Url.ToString
End Sub
Form1
Dim Browser As New WebBrowser
TabControl1.TabPages.Add("New Page")
Browser.Name = "Web Browser"
Browser.Dock = DockStyle.Fill
TabControl1.SelectedTab.Controls.Add(Browser)
AddHandler Browser.ProgressChanged, AddressOf Loading
AddHandler Browser.DocumentCompleted, AddressOf Done
int = int + 1
CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).GoHome()
Voltar
CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).GoBack()
Avançar
CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).GoForward()
Parar
CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).Stop()
Pagina Inicial
CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).GoHome()
Recarregar
CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).Refresh()
Ir
Ir TextBox2
Timer1
Propiedade da Pagina
Recarregar Página
Iniciando a Programação
Public Class Form1
Dim int As Integer = 0
Private Sub Loading(ByVal sender As Object, ByVal e As Windows.Forms.WebBrowserProgressChangedEventArgs)
ToolStripProgressBar1.Maximum = e.MaximumProgress
ToolStripProgressBar1.Value = e.CurrentProgress
End Sub
=========================================================================
Private Sub Done(ByVal sender As Object, ByVal e As Windows.Forms.WebBrowserDocumentCompletedEventArgs)
TabControl1.SelectedTab.Text = CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).DocumentTitle
TextBox1.Text = CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).Url.ToString
ToolStripStatusLabel1.Text = CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).Url.ToString
End Sub
Form1
Dim Browser As New WebBrowser
TabControl1.TabPages.Add("New Page")
Browser.Name = "Web Browser"
Browser.Dock = DockStyle.Fill
TabControl1.SelectedTab.Controls.Add(Browser)
AddHandler Browser.ProgressChanged, AddressOf Loading
AddHandler Browser.DocumentCompleted, AddressOf Done
int = int + 1
CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).GoHome()
Voltar
CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).GoBack()
Avançar
CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).GoForward()
Parar
CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).Stop()
Pagina Inicial
CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).GoHome()
Recarregar
CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).Refresh()
Ir
CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).Navigate(TextBox1.Text)
Google
CType(TabControl1.SelectedTab.Controls.Item(0),WebBrowser).Navigate("www.google.com")
Ir TextBox2
CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).Navigate(TextBox2.Text)
Timer1
ToolStripStatusLabel1.Text = CType(TabControl1.SelectedTab.Controls.Item(0),
WebBrowser).StatusText
Códigos para ToolStripMenuItem
Nova Janela
Dim f As New Form1
f.Show()
Fechar Janela
f.Show()
Fechar Janela
Me.Close()
Nova Aba
Nova Aba
Dim Browser As New WebBrowser
TabControl1.TabPages.Add("New Page")
TabControl1.SelectTab(int)
Browser.Name = "Web Browser"
Browser.Dock = DockStyle.Fill
TabControl1.SelectedTab.Controls.Add(Browser)
AddHandler Browser.ProgressChanged, AddressOf Loading
AddHandler Browser.DocumentCompleted, AddressOf Done
int = int + 1
CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).GoHome()
TabControl1.TabPages.Add("New Page")
TabControl1.SelectTab(int)
Browser.Name = "Web Browser"
Browser.Dock = DockStyle.Fill
TabControl1.SelectedTab.Controls.Add(Browser)
AddHandler Browser.ProgressChanged, AddressOf Loading
AddHandler Browser.DocumentCompleted, AddressOf Done
int = int + 1
CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).GoHome()
Fechar Aba
If Not TabControl1.TabPages.Count = 1 Then
TabControl1.TabPages.RemoveAt(TabControl1.SelectedIndex)
TabControl1.SelectTab(TabControl1.TabPages.Count - 1)
int = int - 1
End If
TabControl1.TabPages.RemoveAt(TabControl1.SelectedIndex)
TabControl1.SelectTab(TabControl1.TabPages.Count - 1)
int = int - 1
End If
Configurar Pagina
CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).ShowPageSetupDialog()
Visualizar Impressão
Visualizar Impressão
CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).ShowPrintPreviewDialog()
Imprimir
CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).ShowPrintPreviewDialog()
Propiedade da Pagina
CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).ShowPropertiesDialog()
Fechar
Fechar
Close()
Desfazer
CType(TabControl1.SelectedTab.Controls.Item(0),WebBrowser).Document.ExecCommand("Undo", False, vbNull)
Refazer
Refazer
CType(TabControl1.SelectedTab.Controls.Item(0),WebBrowser).Document.ExecCommand("Redo", False, vbNull)
Copiar
Copiar
CType(TabControl1.SelectedTab.Controls.Item(0),WebBrowser).Document.ExecCommand("Copy", False, vbNull)
Colar
Colar
CType(TabControl1.SelectedTab.Controls.Item(0),WebBrowser).Document.ExecCommand("Paste", False, vbNull)
Excluir
Excluir
CType(TabControl1.SelectedTab.Controls.Item(0),WebBrowser).Document.ExecCommand("Cut", False, vbNull)
Selecionar Tudo
CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).Document.ExecCommand("SelectAll", True, vbNull)
Voltar
Voltar
CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).GoBack()
Avançar
Avançar
CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).GoForward()
PaginaInicial
PaginaInicial
CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).GoHome()
Recarregar Página
CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).Refresh()
Relogio
Relogio
Relogio.Show()
Cronometro
Cronometro
Cronometro.Show()
Nenhum comentário:
Postar um comentário