Results 1 to 3 of 3

Thread: [2005] Building Web browser need help setting Browser size

  1. #1

    Thread Starter
    Member
    Join Date
    Oct 2006
    Location
    Wales
    Posts
    36

    [2005] Building Web browser need help setting Browser size

    Hi

    i am trying to program a web browser it is not nearly finished but i am having a small problem.

    when you open the file the web broswer is sized and fits nicely BUT when u maximize the client there is a gap left between the toolstrip and the web browser.

    I am asking how i can make the web browser to auto fit to any size the actual client is sized to by the user ?

    i have attached the client so you guys can understand what i mean would appreciate any help here is the code :-

    VB Code:
    1. Public Class Form1
    2.     Inherits System.Windows.Forms.Form
    3.     Dim HP As String 'home page
    4.     Dim SVP As Boolean 'enabled saving page
    5.     Dim WAC As Integer 'number of saved pages
    6.     Private Sub SetAsHomepaToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SetAsHomepaToolStripMenuItem.Click
    7.         HP = InputBox("Type Home Page", "Setting Home Page", "No Home Page").ToString 'Set Home Page
    8.         SaveOptions() 'Saving CyaBrowser Options
    9.     End Sub
    10.     Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    11.         Me.WindowState = FormWindowState.Maximized
    12.         CyaBrowser.Dock = DockStyle.Bottom
    13.         URL.Text = HP
    14.         BrowseWeb() 'Open Home Page
    15.         PageSave.Checked = SVP
    16.         LoadOptions() 'Loading CyaBrowser Options
    17.     End Sub
    18.     Private Sub BrowseWeb()
    19.         'Browse Web and open Page
    20.         CyaBrowser.Navigate(URL.Text)
    21.         StatusBar.Text = URL.Text
    22.     End Sub
    23.     Private Sub frmMain_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing
    24.         SaveOptions() 'Saving CyaBrowser Options
    25.     End Sub
    26.     Private Sub MenuExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuExit.Click
    27.         SaveOptions()
    28.     End Sub
    29.     Private Sub PageSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PageSave.Click
    30.         'set while pages will be saved
    31.         If SVP = True Then
    32.             PageSave.Checked = False
    33.         Else
    34.             PageSave.Checked = True
    35.         End If
    36.         SVP = PageSave.Checked
    37.         SaveOptions() 'Saving CyaBrowser Options
    38.     End Sub
    39.     Private Sub btnGo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGo.Click
    40.         BrowseWeb() 'Start Browsing Web
    41.         CheckList() 'Saving pages
    42.     End Sub
    43.     Private Sub WA_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles URL.KeyUp
    44.         If e.KeyCode = Keys.Enter Then
    45.             BrowseWeb() 'Start Browsing Web
    46.             CheckList() 'saving pages
    47.         End If
    48.     End Sub
    49.     Private Sub CheckList()
    50.         'saving page
    51.         Dim bl As Boolean = True
    52.         Dim i As Integer
    53.         If SVP = True Then
    54.             'checks if page is all ready saved
    55.             For i = 0 To URL.Items.Count - 1
    56.                 If URL.Text = URL.Items.Item(i) Then
    57.                     bl = False
    58.                 End If
    59.             Next i
    60.             If bl = True Then
    61.                 URL.Items.Add(URL.Text)
    62.                 WAC = URL.Items.Count - 1
    63.                 SaveOptions()
    64.             End If
    65.             If WAC > 0 Then
    66.                 SaveOptions() 'Saving SpeedNet Options
    67.             End If
    68.         End If
    69.     End Sub
    70.     Private Sub SearchingTools(ByVal index As Integer)
    71.         On Error Resume Next
    72.         Select Case index
    73.             Case 1
    74.                 BrowseWeb() 'Start Browsing Web
    75.                 CheckList() 'saving pages
    76.             Case 2
    77.                 CyaBrowser.GoBack() 'go back
    78.             Case 3
    79.                 CyaBrowser.GoForward() 'go forward
    80.             Case 4
    81.                 CyaBrowser.Stop() 'stop browsing
    82.             Case 5
    83.                 CyaBrowser.Refresh() 'refresh browser
    84.             Case 6
    85.                 URL.Text = HP
    86.                 BrowseWeb() 'open home page
    87.         End Select
    88.     End Sub
    89.     Private Sub SaveOptions()
    90.         'saving CyaBrowser options and pages
    91.         Dim i As Integer
    92.         'open file
    93.         Dim File As System.IO.FileInfo = New System.IO.FileInfo(System.Windows.Forms.Application.StartupPath & "\CyaBrowser")
    94.         Dim WriteFile As System.IO.StreamWriter = File.CreateText()
    95.         'save oprions
    96.         WriteFile.WriteLine(HP)
    97.         WriteFile.WriteLine(SVP)
    98.         WriteFile.WriteLine(WAC)
    99.         'save pages
    100.         If WAC > 0 Then
    101.             For i = 0 To WAC
    102.                 WriteFile.WriteLine(URL.Items.Item(i).ToString)
    103.             Next
    104.         End If
    105.         WriteFile.Close()
    106.     End Sub
    107.     Private Sub LoadOptions()
    108.         'loading CyaBrowser options and pages
    109.         Dim i As Integer
    110.         'open file
    111.         Dim File As System.IO.FileInfo = New System.IO.FileInfo(System.Windows.Forms.Application.StartupPath & "\CyaBrowser")
    112.         'if file exists then load options and pages
    113.         If File.Exists = True Then
    114.             Dim ReadFile As System.IO.StreamReader = File.OpenText()
    115.             'load options
    116.             HP = ReadFile.ReadLine
    117.             SVP = ReadFile.ReadLine
    118.             WAC = ReadFile.ReadLine
    119.             'if there is any saved pages then load pages
    120.             If WAC > 0 Then
    121.                 For i = 0 To WAC
    122.                     URL.Items.Add(ReadFile.ReadLine)
    123.                 Next
    124.             End If
    125.             ReadFile.Close()
    126.             PageSave.Checked = SVP
    127.         Else 'if files not exists then
    128.             DefaultOptions() ' set CyaBrowser default options
    129.         End If
    130.     End Sub
    131.     Private Sub DefaultOptions()
    132.         'setting CyaBrowser default options
    133.         'create new file
    134.         Dim File As System.IO.FileInfo = New System.IO.FileInfo(System.Windows.Forms.Application.StartupPath & "\CyaBrowser")
    135.         Dim WriteFile As System.IO.StreamWriter = File.CreateText()
    136.         'set dfault options
    137.         WriteFile.WriteLine("No Home Page")
    138.         WriteFile.WriteLine(False)
    139.         WriteFile.WriteLine(0)
    140.         WriteFile.Close()
    141.         'then load options
    142.         LoadOptions()
    143.     End Sub
    144.     Private Sub ToolStripButton2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton2.Click
    145.         CyaBrowser.GoBack()
    146.     End Sub
    147.     Private Sub ToolStripButton3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton3.Click
    148.         CyaBrowser.GoForward()
    149.     End Sub
    150.     Private Sub btnStop_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
    151.         CyaBrowser.Stop()
    152.     End Sub
    153.     Private Sub ToolStripButton5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton5.Click
    154.         CyaBrowser.Refresh()
    155.     End Sub
    156. End Class
    Attached Files Attached Files

  2. #2
    Addicted Member ZenDisaster's Avatar
    Join Date
    Dec 2006
    Location
    Bay Area, CA
    Posts
    140

    Re: [2005] Building Web browser need help setting Browser size

    Removed
    Last edited by ZenDisaster; Dec 28th, 2006 at 09:37 PM.

  3. #3

    Thread Starter
    Member
    Join Date
    Oct 2006
    Location
    Wales
    Posts
    36

    Re: [2005] Building Web browser need help setting Browser size

    yea i cant understand either i mean at first it looks exactly hw i want it to then i click the maximize tab and it has about an inch just a little bit less gap tried a few things so i was thinkin there must be some code that i do not know that will constantly have it auto size to the window

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width