But now i want to add ( as i call then ) quciklinks..or.. "bookmarks" that is allways show in the webbrowser.. so you just click on them and the page will be loaded. not to hard, right?
Well, i dont know if i shout use settings to save the name and the page-adress. but then i will have to set a maximum number of bookmarks. or i could use a databas, but i´m not familiar with the code and cant handle it. and the last option would be to save the information in a .txt file som somthing like that, but i´m not familiar with the either. There is an other problem with this also, i want the "/fav" icon of the page to be saved and show in the bookmark, BUT i have tried to get it to be show´n in the form while i´m using it and tried to load it in to a picturebox but i cant get it to work.
Here is my code for geting the "/fav" icon
Dim iconURL = "http://" & CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).Url.Host & "/favicon.ico" Dim request As System.Net.WebRequest = System.Net.HttpWebRequest.Create(iconURL) Dim response As System.Net.HttpWebResponse = request.GetResponse() Dim stream As System.IO.Stream = response.GetResponseStream() Dim favicon = Image.FromStream(stream) If stream.WriteTimeout Then PictureBox1.Image = favicon End If
and here it my code for frmMain (form1)
Public Class Form1
Public WithEvents oDoc As HtmlDocument
Private oElement As HtmlElement
Private TempPopAllowed As Boolean = False
Private popURL As String
Private LastDomain As String
Friend WithEvents InfoBar1 As WindowsApplication1.InfoBar
Dim i As Integer = 1
Private Property IsWebBrowserContextMenuEnabled As Boolean
Dim _imgHitArea As Point = New Point(13, 5)
Dim _imageLocation As Point = New Point(15, 5)
' The size of the X in each tab's upper right corner.
Private m_Xwid As Integer = 8
Private Const TAB_MARGIN As Integer = 3
Dim s As String
'Public Sub New()
' InitializeComponent()
' 'Set the Mode of Drawing as Owner Drawn
' TabControl1.DrawMode = System.Windows.Forms.TabDrawMode.OwnerDrawFixed
' 'Add the Handler to draw the Image on Tab Pages
' AddHandler TabControl1.DrawItem, AddressOf TabControl1_DrawItem
'End Sub
'Private Sub TabControl1_DrawItem(ByVal sender As Object, ByVal e As System.Windows.Forms.DrawItemEventArgs)
' Try
' 'Close Image to draw
' Dim img As Image = New Bitmap("C:\Close.gif")
' Dim r As Rectangle = e.Bounds
' TabControl1.SelectedTab.BackColor = Color.MintCream
' TabControl1.SelectedTab.BorderStyle = BorderStyle.Fixed3D
' TabControl1.SelectedTab.ForeColor = Color.Coral
' r = Me.TabControl1.GetTabRect(e.Index)
' r.Offset(2, 2)
' Dim TitleBrush As Brush = New SolidBrush(Color.Black)
' Dim f As Font = Me.Font
' Dim title As String = Me.TabControl1.TabPages(e.Index).Text
' e.Graphics.DrawString(title, f, TitleBrush, New PointF(r.X, r.Y))
' e.Graphics.DrawImage(img, New Point(r.X + (Me.TabControl1.GetTabRect(e.Index).Width - _imageLocation.X), _imageLocation.Y))
' Catch ex As Exception
' MsgBox(ex.Message)
' End Try
'End Sub
Private Sub TabControl1_DrawItem1(ByVal sender As Object, ByVal e As System.Windows.Forms.DrawItemEventArgs) Handles TabControl1.DrawItem
'Firstly we'll define some parameters.
Dim CurrentTab As TabPage = TabControl1.TabPages(e.Index)
Dim ItemRect As Rectangle = TabControl1.GetTabRect(e.Index)
Dim FillBrush As New SolidBrush(Color.Black)
Dim TextBrush As New SolidBrush(Color.Black)
Dim sf As New StringFormat
sf.Alignment = StringAlignment.Center
sf.LineAlignment = StringAlignment.Center
'If we are currently painting the Selected TabItem we'll
'change the brush colors and inflate the rectangle.
If CBool(e.State And DrawItemState.Selected) Then
FillBrush.Color = Color.Black
TextBrush.Color = Color.Black
ItemRect.Inflate(2, 2)
End If
'Set up rotation for left and right aligned tabs
If TabControl1.Alignment = TabAlignment.Left Or TabControl1.Alignment = TabAlignment.Right Then
Dim RotateAngle As Single = 90
If TabControl1.Alignment = TabAlignment.Left Then RotateAngle = 270
Dim cp As New PointF(ItemRect.Left + (ItemRect.Width \ 2), ItemRect.Top + (ItemRect.Height \ 2))
e.Graphics.TranslateTransform(cp.X, cp.Y)
e.Graphics.RotateTransform(RotateAngle)
ItemRect = New Rectangle(-(ItemRect.Height \ 2), -(ItemRect.Width \ 2), ItemRect.Height, ItemRect.Width)
End If
' We draw in the TabRect rather than on e.Bounds
' so we can use TabRect later in MouseDown.
Dim tab_rect As Rectangle = TabControl1.GetTabRect(e.Index)
' Allow room for margins.
Dim layout_rect As New RectangleF( _
tab_rect.Left + TAB_MARGIN, _
tab_rect.Y + TAB_MARGIN, _
tab_rect.Width - 3 * TAB_MARGIN, _
tab_rect.Height + 7 * TAB_MARGIN)
Dim string_format As New StringFormat
'Next we'll paint the TabItem with our Fill Brush
e.Graphics.DrawImage(My.Resources.texture2, ItemRect)
' Draw the tab's text centered.
Dim big_font As New Font(Me.Font, FontStyle.Regular)
string_format.Alignment = StringAlignment.Center
string_format.LineAlignment = StringAlignment.Center
e.Graphics.DrawString( _
TabControl1.TabPages(e.Index).Text, _
big_font, _
FillBrush, _
layout_rect, _
string_format)
'draw close button
e.Graphics.DrawImage(My.Resources.close_butt, layout_rect.Right - m_Xwid - 7, layout_rect.Top + m_Xwid - 3, 17, 17)
'draw icon
'If Me.Text = "Sida blockerad" Then
' e.Graphics.DrawImage(My.Resources.shield_exc, layout_rect.Right - m_Xwid - 175, layout_rect.Top + m_Xwid - 7, 25, 25)
' PictureBox1.BackgroundImage = My.Resources.shield_exc
'Else
'e.Graphics.DrawImage(PictureBox1.BackgroundImage, layout_rect.Right - m_Xwid - 175, layout_rect.Top + m_Xwid - 7, 25, 25)
'End If
'e.Graphics.DrawImage(My.Resources.busy, layout_rect.Right - m_Xwid - 175, layout_rect.Top + m_Xwid - 7, 25, 25)
'Reset any Graphics rotation
e.Graphics.ResetTransform()
'Finally, we should Dispose of our brushes.
FillBrush.Dispose()
TextBrush.Dispose()
End Sub
'Private Sub TabControl1_DrawItem(ByVal sender As Object, ByVal e As System.Windows.Forms.DrawItemEventArgs) Handles TabControl1.DrawItem
' TabControl1.SelectedTab.BackColor = Color.MintCream
' TabControl1.SelectedTab.BorderStyle = BorderStyle.Fixed3D
' TabControl1.SelectedTab.ForeColor = Color.Coral
' Dim wb As WebBrowser
'End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).Navigate(Textbox1.Text)
End Sub
Private Function FixURL(ByVal sURL As String) As String
sURL = sURL.Trim
If Not sURL.ToLower().StartsWith("http://") _
Then sURL = "http://" & sURL
Return sURL
End Function
Private Sub WebBrowser_DocumentCompleted(ByVal sender As Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
TabControl1.SelectedTab.Text = CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).DocumentTitle
Dim des As String = CType(Me.TabControl1.SelectedTab.Controls.Item(0), WebBrowser).DocumentTitle
Dim position As Integer
If des.Length > 30 Then
Do Until des.Length < 30
position = des.Length - 1
des = des.Remove(position, 1)
Loop
Me.TabControl1.SelectedTab.Text = des + "..."
Else
Me.TabControl1.SelectedTab.Text = des
End If
Me.Textbox1.Items.Add(e.Url.ToString)
If Me.Textbox1.Items.Count >= 15 Then
Textbox1.Items.Clear()
End If
Dim wb As WebBrowser
oDoc = wb.Document
Dim s As String
Dim strDomain() As String
For Each s In My.Settings.BlockedSites
strDomain = Split(s, "http://")
If strDomain(1) = wb.document.Domain Then
wb.DocumentText = My.Resources.Blocked
Exit Sub
End If
Next
Me.Text = wb.DocumentTitle
'Here you may want to prefetch the icon, or implement a form of caching icons.
If LastDomain = oDoc.Domain Then
'We want to leave the popup settings alone.
Else
'different domain, reset the popup blocker.
Me.TempPopAllowed = False
' InfoBar.PictureBox1.Image = My.Resources.help_mwv_exit
' InfoBar.Text = " Pop up blocked."
LastDomain = oDoc.Domain
End If
Dim iconURL = "http://" & CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).Url.Host & "/favicon.ico"
Dim request As System.Net.WebRequest = System.Net.HttpWebRequest.Create(iconURL)
Dim response As System.Net.HttpWebResponse = request.GetResponse()
Dim stream As System.IO.Stream = response.GetResponseStream()
Dim favicon = Image.FromStream(stream)
If stream.WriteTimeout Then
PictureBox1.Image = favicon
End If
End Sub
Private Sub WebBrowser1_EncryptionLevelChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles WebBrowser1.EncryptionLevelChanged
Dim wb As WebBrowser
With Me.lblSec
Select Case wb.EncryptionLevel
Case WebBrowserEncryptionLevel.Bit128
.Image = My.Resources.Lock
Case WebBrowserEncryptionLevel.Bit40
.Image = My.Resources.Lock
Case WebBrowserEncryptionLevel.Bit56
.Image = My.Resources.Lock
Case WebBrowserEncryptionLevel.Fortezza
.Image = My.Resources.Lock
Case WebBrowserEncryptionLevel.Insecure
.Image = My.Resources.LockOpen
Case WebBrowserEncryptionLevel.Mixed
.Image = My.Resources.LockOpen
Case WebBrowserEncryptionLevel.Unknown
.Image = My.Resources.LockOpen
Case Else
.Image = My.Resources.LockOpen
End Select
.ToolTipText = wb.EncryptionLevel.ToString
End With
End Sub
Private Sub WebBrowser_Navigated(ByVal sender As Object, ByVal e As System.Windows.Forms.WebBrowserNavigatedEventArgs) Handles WebBrowser1.Navigated
Textbox1.Text = domain.Text
Dim wb As WebBrowser
If Label1.Text = "Klar" Then
ProgressBar1.Value = 0
End If
Dim s As String
For Each s In My.Settings.BlockedSites
If s = CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).document.Domain Then
domain.Text = CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).document.Domain
CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).Stop()
SplashScreen2.Show()
'CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).Navigate(My.Resources.Blocked)
'Me.Text = "Sida blockerad"
'TabControl1.SelectedTab.Text = "Sida blockerad"
End If
Next
'Dim s As String
For Each s In My.Settings.BlockedSites
If s = e.Url.ToString Or s & "/" = e.Url.ToString Then
CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).Stop()
wb.DocumentText = My.Resources.Blocked
Dim url As Uri = New Uri(Textbox1.Text)
If url.HostNameType = UriHostNameType.Dns Then
Dim iconURL = "http://" & url.Host & "/favicon.ico"
Dim request As System.Net.WebRequest = System.Net.HttpWebRequest.Create(iconURL)
Dim response As System.Net.HttpWebResponse = request.GetResponse()
Dim stream As System.IO.FileStream = response.GetResponseStream()
Dim favicon = Image.FromStream(stream)
PictureBox1.Image = favicon
End If
End If
Next
Dim des As String = CType(Me.TabControl1.SelectedTab.Controls.Item(0), WebBrowser).DocumentTitle
Dim position As Integer
If des.Length > 30 Then
Do Until des.Length < 30
position = des.Length - 1
des = des.Remove(position, 1)
Loop
Me.TabControl1.SelectedTab.Text = des + "..."
Else
Me.TabControl1.SelectedTab.Text = des
End If
End Sub
Private Sub WebBrowser_Navigating(ByVal sender As Object, ByVal e As System.Windows.Forms.WebBrowserNavigatingEventArgs) Handles WebBrowser1.Navigating
' PictureBox1.Image =
End Sub
Private Sub WebBrowser1_NewWindow(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles WebBrowser1.NewWindow
Dim WB As New WebBrowser
'Dim wb As WebBrowser
e.Cancel = True
Dim s As String
For Each s In My.Settings.AllowedPopSites
If s = WB.document.Domain Then
'Site is allowed... Show pop in new tab and exit...
e.Cancel = True
'Dim wb As New WebBrowser
TabControl1.SelectedTab.Controls.Add(WB)
CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).Navigate(WB.document.Domain)
Exit Sub
End If
Next
If My.Settings.PopUpBlockerEnabled = True Then
If Me.TempPopAllowed = True Then
'Site temporarily allowed... open in new tab, then exit...
e.Cancel = True
'Dim ofrm As New WebBrowser
Dim i As Integer = 0
WB.Parent = TabControl1.TabPages(0)
AddHandler WB.ProgressChanged, AddressOf WebBrowser_ProgressChanged
AddHandler WB.DocumentCompleted, AddressOf WebBrowser_DocumentCompleted
TabControl1.SelectTab(i)
TabControl1.SelectedTab.Controls.Add(WB)
i = i + 1
Dim tab As New TabPage '(TextBox1.Text)
tab.Controls.Add(WB)
TabControl1.TabPages.Add(tab)
WB.Dock = DockStyle.Fill
CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).Stop()
SplashScreen3.Show()
'CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).Navigate(WB.document.Domain)
Exit Sub
Else
'Blocker is enabled and not temp allowed...
e.Cancel = True
If My.Settings.PopSound = True Then
My.Computer.Audio.Play(My.Resources.Windows_Pop_up_Blocked, AudioPlayMode.Background)
End If
If My.Settings.PopInfoBar = True Then
Me.InfoBar1.Visible = True
End If
popURL = CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).StatusText
End If
Else
'Blocker is not enabled... open in new tab.
e.Cancel = True
'Dim ofrm As New WebBrowser
TabControl1.SelectTab(i)
TabControl1.SelectedTab.Controls.Add(WB)
i = i + 1
Dim tab As New TabPage '(TextBox1.Text)
tab.Controls.Add(WB)
TabControl1.TabPages.Add(tab)
WB.Dock = DockStyle.Fill
CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).Navigate(WB.document.Domain)
End If
End Sub
Private Sub WebBrowser1_PreviewKeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.PreviewKeyDownEventArgs) Handles WebBrowser1.PreviewKeyDown
End Sub
Private Sub WebBrowser_ProgressChanged(ByVal sender As Object, ByVal e As System.Windows.Forms.WebBrowserProgressChangedEventArgs) Handles WebBrowser1.ProgressChanged
If e.MaximumProgress <> 0 And _
e.MaximumProgress >= e.CurrentProgress Then
ProgressBar1.Value = Convert.ToInt32( _
100 * e.CurrentProgress / e.MaximumProgress)
End If
If ProgressBar1.Value = e.MaximumProgress Then
ProgressBar1.Value = ProgressBar1.Minimum
End If
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).Stop()
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).Refresh()
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim wb As WebBrowser
NotifyIcon1.Visible = True
CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).Navigate(My.Settings.StartPage)
Dim myWebBrowser As New WebBrowser
TabControl1.SelectTab(1 - 1)
TabControl1.SelectedTab.Controls.Add(myWebBrowser)
i = i + 1
IsWebBrowserContextMenuEnabled = False
'Textbox1.Text = wb.Url.ToString
Dim tab_size As Size = TabControl1.ItemSize
tab_size.Width = 200
tab_size.Height += 4
TabControl1.ItemSize = tab_size
End Sub
Private Sub AddTabToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AddTabToolStripMenuItem.Click
Dim i As Integer = 0
Dim WB As New WebBrowser
WB.Parent = TabControl1.TabPages(0)
AddHandler WB.ProgressChanged, AddressOf WebBrowser_ProgressChanged
AddHandler WB.DocumentCompleted, AddressOf WebBrowser_DocumentCompleted
AddHandler WB.StatusTextChanged, AddressOf WebBrowser_StatusTextChanged
TabControl1.SelectTab(i)
TabControl1.SelectedTab.Controls.Add(WB)
i = i + 1
Dim tab As New TabPage '(TextBox1.Text)
tab.Controls.Add(WB)
TabControl1.TabPages.Add(tab)
WB.Dock = DockStyle.Fill
End Sub
Private Sub tabortflikToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RemoveTabToolStripMenuItem.Click
TabControl1.TabPages.RemoveAt(TabControl1.SelectedIndex)
TabControl1.SelectTab(TabControl1.TabPages.Count - 1)
i = i - 1
End Sub
Private Sub WebBrowser_StatusTextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles WebBrowser1.StatusTextChanged
Label1.Text = CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).StatusText.ToString()
End Sub
Private Sub OpenInNewTabToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OpenInNewTabToolStripMenuItem.Click
'Textbox1.Text = e.ToString
Dim i As Integer = 0
Dim WB As New WebBrowser
WB.Parent = TabControl1.TabPages(0)
TabControl1.SelectTab(i)
TabControl1.SelectedTab.Controls.Add(WB)
i = i + 1
Dim tab As New TabPage '(TextBox1.Text)
tab.Controls.Add(WB)
TabControl1.TabPages.Add(tab)
WB.Dock = DockStyle.Fill
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).GoBack()
End Sub
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).GoForward()
End Sub
Private Sub OptionsToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OptionsToolStripMenuItem.Click
Form2.Show()
End Sub
Private Sub AboutToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AboutToolStripMenuItem.Click
About.Show()
End Sub
Private Sub Panel2_Paint(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Panel2.Paint
End Sub
Private Sub Label1_Click(ByVal sender As Object, ByVal e As System.EventArgs)
End Sub
Private Sub SaveAsToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SaveAsToolStripMenuItem1.Click
frmMain.Visible = True
SplashScreen1.Show()
End Sub
Private Sub TabControl1_MouseDoubleClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles TabControl1.MouseDoubleClick
TabControl1.TabPages.RemoveAt(TabControl1.SelectedIndex)
TabControl1.SelectTab(TabControl1.TabPages.Count - 1)
i = i - 1
End Sub
Private Sub StängFlikToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
End Sub
Private Sub ProgressBar1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ProgressBar1.Click
End Sub
Private Sub NotifyIcon1_MouseDoubleClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles NotifyIcon1.MouseDoubleClick
Me.WindowState = FormWindowState.Normal
End Sub
Private Sub ÖppnaToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ÖppnaToolStripMenuItem.Click
Me.WindowState = FormWindowState.Normal
'If Me.WindowState = FormWindowState.Minimized Then
' ÖppnaToolStripMenuItem.Enabled = True
'End If
'If Me.WindowState = FormWindowState.Maximized Then
' ÖppnaToolStripMenuItem.Enabled = False
'End If
'If Me.WindowState = FormWindowState.Normal Then
' ÖppnaToolStripMenuItem.Enabled = False
'End If
MinimeraToolStripMenuItem.Enabled = True
ÖppnaToolStripMenuItem.Enabled = False
Refresh()
End Sub
Private Sub MinimeraToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MinimeraToolStripMenuItem.Click
Me.WindowState = FormWindowState.Minimized
'If Me.WindowState = FormWindowState.Minimized Then
' MinimeraToolStripMenuItem.Enabled = False
'End If
'If Me.WindowState = FormWindowState.Maximized Then
' MinimeraToolStripMenuItem.Enabled = True
'End If
'If Me.WindowState = FormWindowState.Normal Then
' MinimeraToolStripMenuItem.Enabled = True
'End If
ÖppnaToolStripMenuItem.Enabled = True
MinimeraToolStripMenuItem.Enabled = False
Refresh()
End Sub
Private Sub AvslutaToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AvslutaToolStripMenuItem.Click
Me.Close()
SplashScreen1.Close()
frmMain.Close()
Form2.Close()
About.Close()
NotifyIcon1.Dispose()
End Sub
Private Sub btnAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAdd.Click
My.Settings.fav.Add(CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).Url.ToString)
cbxFavourites.Items.Add(CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).Url.ToString)
End Sub
Private Sub cbxFavourites_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cbxFavourites.Click
'On Error Resume Next
CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).Navigate(cbxFavourites.SelectedItem.ToString)
End Sub
Private Sub TabControl1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles TabControl1.MouseDown
' See if this is over a tab.
For s As Integer = 0 To TabControl1.TabPages.Count - 1
' Get the TabRect plus room for margins.
Dim tab_rect As Rectangle = TabControl1.GetTabRect(s)
Dim rect As New RectangleF( _
tab_rect.Left + TAB_MARGIN, _
tab_rect.Y + TAB_MARGIN, _
tab_rect.Width - 2 * TAB_MARGIN, _
tab_rect.Height - 2 * TAB_MARGIN)
If e.X >= rect.Right - m_Xwid AndAlso _
e.X <= rect.Right AndAlso _
e.Y >= rect.Top AndAlso _
e.Y <= rect.Top + m_Xwid _
Then
If TabControl1.TabCount = 1 = False Then
Debug.WriteLine("Tab " & s)
TabControl1.TabPages.RemoveAt(TabControl1.SelectedIndex)
i = i - 1
Exit Sub
End If
End If
Next s
End Sub
Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).Navigate(My.Settings.HomePage)
End Sub
Private Sub Textbox1_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Textbox1.TextChanged
'Textbox1.Text = CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).document.Domain
'Refresh()
End Sub
Private Sub TabControl1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles TabControl1.SelectedIndexChanged
Me.Text = TabControl1.SelectedTab.Text & " - Pontus Browser"
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
If Me.WindowState = FormWindowState.Minimized Then ÖppnaToolStripMenuItem.Enabled = True
If (Me.WindowState = FormWindowState.Maximized Or Me.WindowState = FormWindowState.Normal) Then ÖppnaToolStripMenuItem.Enabled = False
If (Me.WindowState = FormWindowState.Maximized Or Me.WindowState = FormWindowState.Normal) Then MinimeraToolStripMenuItem.Enabled = True
If Me.WindowState = FormWindowState.Minimized Then MinimeraToolStripMenuItem.Enabled = False
End Sub
Private Sub MenuStrip1_ItemClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ToolStripItemClickedEventArgs) Handles MenuStrip1.ItemClicked
End Sub
Private Sub domain_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles domain.TextChanged
Textbox1.Text = domain.Text
End Sub
Private Sub Label1_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Label1.TextChanged
Label2.Visible = False
End Sub
Private Sub ToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripMenuItem1.Click
Dim ofrm As New frmHistory
ofrm.LoadMode = frmHistory.LoadModes.History
ofrm.Text = "History Viewer"
'TabControl1.TabPages.Add(TabPage.)
i = i + 1
End Sub
Private Sub NyQuickLinkToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NyQuickLinkToolStripMenuItem.Click
End Sub
End Class
and if you could take a look at why "open in new tab" don´t work.
Edit:
when i was trying to get quicklinks to work, then i was using a menustrip ad the buttons.
thanks in advance
This post has been edited by EndLessMind: 10 October 2009 - 04:12 PM

New Topic/Question
Reply




MultiQuote



|