View difference between Paste ID: wZK2AWDs and ciTYJzDd
SHOW: | | - or go back to the newest paste.
1-
// http://www.dotnetperls.com/webbrowser
1+
2
using System.Windows.Forms;
3
4
namespace ConsoleApplication1
5-
namespace WindowsFormsApplication1
5+
6
    internal class Program
7-
    public partial class Form1 : Form
7+
8
        [STAThread]
9-
      public Form1()
9+
        private static void Main()
10-
      {
10+
        {
11-
          InitializeComponent();
11+
            var browser = new WebBrowser {Dock = DockStyle.Fill};
12-
      }
12+
            var address = new TextBox {Dock = DockStyle.Top};
13
            var button = new Button {Text = "Go!", Dock = DockStyle.Top};
14-
      private void Form1_Load(object sender, EventArgs e)
14+
            button.Click += (o, e) => browser.Url = new Uri(address.Text);
15-
      {
15+
            browser.Navigated += (o, e) => address.Text = e.Url.ToString();
16-
          webBrowser1.Navigate("http://habrahabr.ru/");
16+
            var f = new Form();
17-
      }
17+
            f.Controls.Add(browser);
18
            f.Controls.Add(button);
19-
      private void webBrowser1_Navigating(object sender, WebBrowserNavigatingEventArgs e)
19+
            f.Controls.Add(address);
20-
      {
20+
            f.ShowDialog();
21-
          this.Text = "Navigating";
21+
        }
22-
      }
22+
23
}