Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- open System.Windows.Forms
- let form = new Form(Text = "Web browser", TopMost = true)
- let webBrowser = new WebBrowser()
- let browserPanel = new TableLayoutPanel()
- browserPanel.RowCount <- 2
- browserPanel.ColumnCount <- 1
- browserPanel.Dock <- DockStyle.Fill
- let panel = new Panel()
- panel.Dock <- DockStyle.Fill
- let txtAddr = new TextBox()
- txtAddr.Dock <- DockStyle.Fill
- let btnGo = new Button(Text = "Go!")
- btnGo.Dock <- DockStyle.Right
- panel.Height <- txtAddr.Height
- webBrowser.Dock <- DockStyle.Fill
- let navigate (text: string) =
- webBrowser.Navigate text
- btnGo.Click.Add(fun _ ->
- navigate txtAddr.Text
- )
- txtAddr.KeyUp.Add(fun e ->
- match e.KeyCode with
- | Keys.Enter -> navigate txtAddr.Text
- | _ -> ()
- )
- panel.Controls.Add(txtAddr)
- panel.Controls.Add(btnGo)
- browserPanel.Controls.Add(panel, 0, 0)
- browserPanel.Controls.Add(webBrowser, 1, 0)
- form.Controls.Add(browserPanel)
- form.Show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement