Click here to Skip to main content
15,879,239 members
Articles / Programming Languages / C#

ZeBrowser : Easy to build a browser using VS.Net 2005's new controls

Rate me:
Please Sign up or sign in to vote.
2.73/5 (16 votes)
3 Jul 20043 min read 78.7K   1.7K   32  
Shows how easy it is to build a browser using VS.NET 2005
#region Author Information
//--------------------------------------------
//
//Copyright @ May/2004
// Version: May VS.NET 2005
// Author: Carlos R. Lacerda
// Date: 05/02/2004
// Web Site: www.byteshift.com
//
//--------------------------------------------- 
#endregion

#region Using directives

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.IO;

#endregion

#region Program
namespace ZeBrowser
{
	
	class FormInternet : System.Windows.Forms.Form
	{
		#region Constructor
		public FormInternet()
		{
			InitializeComponent();
			// this is not working with IDE
			// force by code
			this.ComboBoxAddress.Size = new System.Drawing.Size(650, 25);
			this.GoButton.Size = new System.Drawing.Size(60, 22);
			statusWebPanel2.ToolTipText = System.DateTime.Now.ToShortTimeString();
			statusWebPanel2.Text = System.DateTime.Now.ToShortTimeString();

			// 
			// progressBar control hosted in ToolStrip by code
			// 
			this.progressBar = new System.Windows.Forms.ProgressBar();
			this.progressBar.Name = "progressBar1";
			this.progressBar.AutoSize = false;
			this.progressBar.Size = new System.Drawing.Size(200, 10);
            this.progressBar.Minimum = 0;
			// use percet value
			this.progressBar.Maximum = 100; 
			this.progressBar.TabIndex = 9;
			ToolStripControlHost myControl = new ToolStripControlHost(progressBar);
			myControl.Size = new System.Drawing.Size(200, 10);
            this.toolStrip2.Items.Add(myControl);

		}
	#endregion

		#region variables region
		private ToolStrip toolStrip2;
		private ToolStrip toolStrip1;
		private ToolStripLabel toolStripLabel1;
		private MenuStrip menuStrip1;
		private ToolStripMenuItem fileToolStripMenuItem;
		private ToolStripMenuItem navigateToolStripMenuItem;
		private ToolStripMenuItem backToolStripMenuItem;
		private ToolStripMenuItem forwardToolStripMenuItem;
		private ToolStripMenuItem navigateToolStripMenuItem1;
		private ToolStripMenuItem backToolStripMenuItem1;
		private ToolStripMenuItem forwardToolStripMenuItem1;
		private ToolStripMenuItem stopToolStripMenuItem;
		private ToolStripMenuItem refreshToolStripMenuItem;
		private ToolStripMenuItem homeToolStripMenuItem;
		private ToolStripMenuItem helpToolStripMenuItem;
		private ToolStripMenuItem aboutToolStripMenuItem;
		private StatusStrip statusStrip1;
		private SplitContainer splitContainer1;
		private WebBrowser WebBrowser1;
		private ToolStripSeparator toolStripSeparator3;
		private Panel panel1;
		private OpenFileDialog openFileDialog1;
		private ToolStripMenuItem openToolStripMenuItem;
		private ToolStripSplitButton ForwardButton;
		private ToolStripButton StopButton;
		private ToolStripButton RefreshButton;
		private ToolStripButton HomeButton;
		private ToolStripComboBox ComboBoxAddress;
		private ToolStripButton GoButton;
		//private ToolStripButton BackButton;
		private ToolStripSplitButton BackButton;
		private ToolStripMenuItem toolStripMenuItem1;
		private StatusStripPanel statusWebPanel2;
		private StatusStripPanel statusWebPanel;
		private ListBox listBox1;
		private ToolStripSeparator toolStripSeparator1;
		private ProgressBar progressBar;
	#endregion

		#region menu items

		// Displays the Save dialog box.
		private void MenuItemFileSaveAs_Click(System.Object sender,
			System.EventArgs e)
		{
			//this.WebBrowser1.ShowSaveAsDialog();
		}

		// Displays the Page Setup dialog box.
		private void MenuItemFilePageSetup_Click(System.Object sender,
			System.EventArgs e)
		{
			//this.WebBrowser1.ShowPageSetupDialog();
		}

		// Displays the Print dialog box.
		private void MenuItemFilePrint_Click(System.Object sender,
			System.EventArgs e)
		{
			//this.WebBrowser1.ShowPrintDialog();
		}

		// Displays the Print Preview dialog box.
		private void MenuItemFilePrintPreview_Click(System.Object sender,
			System.EventArgs e)
		{
			//this.WebBrowser1.ShowPrintPreviewDialog();
		}

		// Displays the Properties dialog box.
		private void MenuItemFileProperties_Click(System.Object sender,
			System.EventArgs e)
		{
			//this.WebBrowser1.ShowPropertiesDialog();
		}

		private void MenuItemOpenFile_Click(object sender, EventArgs e)
		{
			openFileDialog1.ShowDialog();
		}

		private void MenuItemExit_Click(object sender, EventArgs e)
		{
			this.Close();
		}
	#endregion

		#region Windows forms designer code

		/// <summary>
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.IContainer components = null;

		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		protected override void Dispose(bool disposing)
		{
			if (disposing && (components != null))
			{
				components.Dispose();
			}
			base.Dispose(disposing);
		}

		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
            this.toolStrip2 = new System.Windows.Forms.ToolStrip();
            this.BackButton = new System.Windows.Forms.ToolStripSplitButton();
            this.ForwardButton = new System.Windows.Forms.ToolStripSplitButton();
            this.StopButton = new System.Windows.Forms.ToolStripButton();
            this.RefreshButton = new System.Windows.Forms.ToolStripButton();
            this.HomeButton = new System.Windows.Forms.ToolStripButton();
            this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
            this.toolStrip1 = new System.Windows.Forms.ToolStrip();
            this.toolStripLabel1 = new System.Windows.Forms.ToolStripLabel();
            this.ComboBoxAddress = new System.Windows.Forms.ToolStripComboBox();
            this.GoButton = new System.Windows.Forms.ToolStripButton();
            this.menuStrip1 = new System.Windows.Forms.MenuStrip();
            this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
            this.openToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
            this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator();
            this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
            this.navigateToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
            this.backToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
            this.forwardToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
            this.navigateToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
            this.backToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
            this.forwardToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
            this.stopToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
            this.refreshToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
            this.homeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
            this.helpToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
            this.aboutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
            this.statusStrip1 = new System.Windows.Forms.StatusStrip();
            this.statusWebPanel2 = new System.Windows.Forms.StatusStripPanel();
            this.statusWebPanel = new System.Windows.Forms.StatusStripPanel();
            this.splitContainer1 = new System.Windows.Forms.SplitContainer();
            this.panel1 = new System.Windows.Forms.Panel();
            this.listBox1 = new System.Windows.Forms.ListBox();
            this.WebBrowser1 = new System.Windows.Forms.WebBrowser();
            this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
            this.toolStrip2.SuspendLayout();
            this.toolStrip1.SuspendLayout();
            this.menuStrip1.SuspendLayout();
            this.statusStrip1.SuspendLayout();
            this.splitContainer1.Panel1.SuspendLayout();
            this.splitContainer1.Panel2.SuspendLayout();
            this.splitContainer1.SuspendLayout();
            this.panel1.SuspendLayout();
            this.SuspendLayout();
// 
// toolStrip2
// 
            this.toolStrip2.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
            this.BackButton,
            this.ForwardButton,
            this.StopButton,
            this.RefreshButton,
            this.HomeButton,
            this.toolStripSeparator1});
            this.toolStrip2.Location = new System.Drawing.Point(0, 67);
            this.toolStrip2.Name = "toolStrip2";
            this.toolStrip2.Raft = System.Windows.Forms.RaftingSides.None;
            this.toolStrip2.Size = new System.Drawing.Size(856, 37);
            this.toolStrip2.TabIndex = 17;
            this.toolStrip2.Text = "toolStrip2";
// 
// BackButton
// 
            this.BackButton.DoubleClickEnabled = true;
            this.BackButton.Image = FormBrowser.MyResources.arrow_back_green_normal;
            this.BackButton.Name = "BackButton";
            this.BackButton.SettingsKey = "FormInternet.BackButton";
            this.BackButton.SplitterWidth = 1;
            this.BackButton.Text = " Back";
            this.BackButton.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
            this.BackButton.Click += new System.EventHandler(this.BackButton_Click);
// 
// ForwardButton
// 
            this.ForwardButton.DoubleClickEnabled = true;
            this.ForwardButton.Image = FormBrowser.MyResources.arrow_green_normal;
            this.ForwardButton.Name = "ForwardButton";
            this.ForwardButton.SettingsKey = "FormInternet.toolStripSplitButton1";
            this.ForwardButton.SplitterWidth = 1;
            this.ForwardButton.Text = " Forward";
            this.ForwardButton.Click += new System.EventHandler(this.ButtonForward_Click);
// 
// StopButton
// 
            this.StopButton.AutoToolTip = false;
            this.StopButton.Image = FormBrowser.MyResources.skip1;
            this.StopButton.Name = "StopButton";
            this.StopButton.SettingsKey = "FormInternet.toolStripButton1";
            this.StopButton.ToolTipText = "Stop";
            this.StopButton.Click += new System.EventHandler(this.ButtonStop_Click);
// 
// RefreshButton
// 
            this.RefreshButton.AutoToolTip = false;
            this.RefreshButton.Image = FormBrowser.MyResources.refresh;
            this.RefreshButton.Name = "RefreshButton";
            this.RefreshButton.SettingsKey = "FormInternet.toolStripButton1";
            this.RefreshButton.ToolTipText = "Refresh";
            this.RefreshButton.Click += new System.EventHandler(this.ButtonRefresh_Click);
// 
// HomeButton
// 
            this.HomeButton.AutoToolTip = false;
            this.HomeButton.Image = FormBrowser.MyResources.home;
            this.HomeButton.Name = "HomeButton";
            this.HomeButton.SettingsKey = "FormInternet.toolStripButton1";
            this.HomeButton.ToolTipText = "Home";
            this.HomeButton.Click += new System.EventHandler(this.ButtonHome_Click);
// 
// toolStripSeparator1
// 
            this.toolStripSeparator1.Name = "toolStripSeparator1";
            this.toolStripSeparator1.SettingsKey = "FormInternet.toolStripSeparator1";
// 
// toolStrip1
// 
            this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
            this.toolStripLabel1,
            this.ComboBoxAddress,
            this.GoButton});
            this.toolStrip1.Location = new System.Drawing.Point(0, 29);
            this.toolStrip1.Name = "toolStrip1";
            this.toolStrip1.Raft = System.Windows.Forms.RaftingSides.None;
            this.toolStrip1.Size = new System.Drawing.Size(856, 38);
            this.toolStrip1.TabIndex = 16;
            this.toolStrip1.Text = "toolStrip1";
// 
// toolStripLabel1
// 
            this.toolStripLabel1.Name = "toolStripLabel1";
            this.toolStripLabel1.SettingsKey = "Form2.toolStripLabel1";
            this.toolStripLabel1.Text = "Address";
// 
// ComboBoxAddress
// 
            this.ComboBoxAddress.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest;
            this.ComboBoxAddress.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.HistoryList;
            this.ComboBoxAddress.Name = "ComboBoxAddress";
            this.ComboBoxAddress.SettingsKey = "FormInternet.toolStripComboBox1";
            this.ComboBoxAddress.Size = new System.Drawing.Size(500, 38);
            this.ComboBoxAddress.ToolTipText = "Address";
            this.ComboBoxAddress.KeyDown += new System.Windows.Forms.KeyEventHandler(this.TextBoxAddress_KeyDown);
// 
// GoButton
// 
            this.GoButton.Font = new System.Drawing.Font("Tahoma", 8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.GoButton.Image = FormBrowser.MyResources.arrow_green_normal;
            this.GoButton.Name = "GoButton";
            this.GoButton.SettingsKey = "FormInternet.toolStripButton1";
            this.GoButton.Text = "   Go";
            this.GoButton.Click += new System.EventHandler(this.ButtonGo_Click);
// 
// menuStrip1
// 
            this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
            this.fileToolStripMenuItem,
            this.navigateToolStripMenuItem,
            this.navigateToolStripMenuItem1,
            this.helpToolStripMenuItem});
            this.menuStrip1.Location = new System.Drawing.Point(0, 0);
            this.menuStrip1.Name = "menuStrip1";
            this.menuStrip1.Padding = new System.Windows.Forms.Padding(6, 2, 0, 2);
            this.menuStrip1.Size = new System.Drawing.Size(856, 29);
            this.menuStrip1.TabIndex = 15;
            this.menuStrip1.Text = "menuStrip1";
// 
// fileToolStripMenuItem
// 
            this.fileToolStripMenuItem.DoubleClickEnabled = true;
            this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
            this.openToolStripMenuItem,
            this.toolStripSeparator3,
            this.toolStripMenuItem1});
            this.fileToolStripMenuItem.Name = "fileToolStripMenuItem";
            this.fileToolStripMenuItem.SettingsKey = "Form1.fileToolStripMenuItem";
            this.fileToolStripMenuItem.Text = "File";
// 
// openToolStripMenuItem
// 
            this.openToolStripMenuItem.DoubleClickEnabled = true;
            this.openToolStripMenuItem.Name = "openToolStripMenuItem";
            this.openToolStripMenuItem.SettingsKey = "FormInternet.openToolStripMenuItem";
            this.openToolStripMenuItem.Text = "&Open...";
            this.openToolStripMenuItem.Click += new System.EventHandler(this.MenuItemOpenFile_Click);
// 
// toolStripSeparator3
// 
            this.toolStripSeparator3.Name = "toolStripSeparator3";
            this.toolStripSeparator3.SettingsKey = "FormInternet.toolStripSeparator3";
// 
// toolStripMenuItem1
// 
            this.toolStripMenuItem1.DoubleClickEnabled = true;
            this.toolStripMenuItem1.Name = "toolStripMenuItem1";
            this.toolStripMenuItem1.SettingsKey = "FormInternet.toolStripMenuItem1";
            this.toolStripMenuItem1.Text = "E&xit";
            this.toolStripMenuItem1.Click += new System.EventHandler(this.MenuItemExit_Click);
// 
// navigateToolStripMenuItem
// 
            this.navigateToolStripMenuItem.DoubleClickEnabled = true;
            this.navigateToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
            this.backToolStripMenuItem,
            this.forwardToolStripMenuItem});
            this.navigateToolStripMenuItem.Name = "navigateToolStripMenuItem";
            this.navigateToolStripMenuItem.SettingsKey = "Form1.navigateToolStripMenuItem";
            this.navigateToolStripMenuItem.Visible = false;
// 
// backToolStripMenuItem
// 
            this.backToolStripMenuItem.DoubleClickEnabled = true;
            this.backToolStripMenuItem.Name = "backToolStripMenuItem";
            this.backToolStripMenuItem.SettingsKey = "Form1.backToolStripMenuItem";
            this.backToolStripMenuItem.Text = "Back";
// 
// forwardToolStripMenuItem
// 
            this.forwardToolStripMenuItem.DoubleClickEnabled = true;
            this.forwardToolStripMenuItem.Name = "forwardToolStripMenuItem";
            this.forwardToolStripMenuItem.SettingsKey = "Form1.forwardToolStripMenuItem";
            this.forwardToolStripMenuItem.Text = "Forward";
// 
// navigateToolStripMenuItem1
// 
            this.navigateToolStripMenuItem1.DoubleClickEnabled = true;
            this.navigateToolStripMenuItem1.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
            this.backToolStripMenuItem1,
            this.forwardToolStripMenuItem1,
            this.stopToolStripMenuItem,
            this.refreshToolStripMenuItem,
            this.homeToolStripMenuItem});
            this.navigateToolStripMenuItem1.Name = "navigateToolStripMenuItem1";
            this.navigateToolStripMenuItem1.SettingsKey = "Form1.navigateToolStripMenuItem1";
            this.navigateToolStripMenuItem1.Text = "&Navigate";
// 
// backToolStripMenuItem1
// 
            this.backToolStripMenuItem1.Alignment = System.Windows.Forms.ToolStripItemAlignment.Tail;
            this.backToolStripMenuItem1.DoubleClickEnabled = true;
            this.backToolStripMenuItem1.Font = new System.Drawing.Font("Tahoma", 8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.backToolStripMenuItem1.Image = FormBrowser.MyResources.arrow_back_green_normal;
            this.backToolStripMenuItem1.Name = "backToolStripMenuItem1";
            this.backToolStripMenuItem1.SettingsKey = "Form1.backToolStripMenuItem1";
            this.backToolStripMenuItem1.Text = "Back";
            this.backToolStripMenuItem1.Click += new System.EventHandler(this.BackButton_Click);
// 
// forwardToolStripMenuItem1
// 
            this.forwardToolStripMenuItem1.DoubleClickEnabled = true;
            this.forwardToolStripMenuItem1.Font = new System.Drawing.Font("Tahoma", 8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.forwardToolStripMenuItem1.Image = FormBrowser.MyResources.arrow_green_normal;
            this.forwardToolStripMenuItem1.Name = "forwardToolStripMenuItem1";
            this.forwardToolStripMenuItem1.SettingsKey = "Form1.forwardToolStripMenuItem1";
            this.forwardToolStripMenuItem1.Text = "Forward";
            this.forwardToolStripMenuItem1.Click += new System.EventHandler(this.ButtonForward_Click);
// 
// stopToolStripMenuItem
// 
            this.stopToolStripMenuItem.DoubleClickEnabled = true;
            this.stopToolStripMenuItem.Font = new System.Drawing.Font("Tahoma", 8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.stopToolStripMenuItem.Image = FormBrowser.MyResources.skip1;
            this.stopToolStripMenuItem.Name = "stopToolStripMenuItem";
            this.stopToolStripMenuItem.SettingsKey = "Form1.stopToolStripMenuItem";
            this.stopToolStripMenuItem.Text = "Stop";
            this.stopToolStripMenuItem.Click += new System.EventHandler(this.ButtonStop_Click);
// 
// refreshToolStripMenuItem
// 
            this.refreshToolStripMenuItem.DoubleClickEnabled = true;
            this.refreshToolStripMenuItem.Font = new System.Drawing.Font("Tahoma", 8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.refreshToolStripMenuItem.Image = FormBrowser.MyResources.refresh;
            this.refreshToolStripMenuItem.Name = "refreshToolStripMenuItem";
            this.refreshToolStripMenuItem.SettingsKey = "Form1.refreshToolStripMenuItem";
            this.refreshToolStripMenuItem.Text = "Refresh";
            this.refreshToolStripMenuItem.Click += new System.EventHandler(this.ButtonRefresh_Click);
// 
// homeToolStripMenuItem
// 
            this.homeToolStripMenuItem.DoubleClickEnabled = true;
            this.homeToolStripMenuItem.Font = new System.Drawing.Font("Tahoma", 8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.homeToolStripMenuItem.Image = FormBrowser.MyResources.home;
            this.homeToolStripMenuItem.Name = "homeToolStripMenuItem";
            this.homeToolStripMenuItem.SettingsKey = "Form1.homeToolStripMenuItem";
            this.homeToolStripMenuItem.Text = "Home";
            this.homeToolStripMenuItem.Click += new System.EventHandler(this.ButtonHome_Click);
// 
// helpToolStripMenuItem
// 
            this.helpToolStripMenuItem.DoubleClickEnabled = true;
            this.helpToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
                this.aboutToolStripMenuItem
            });
            this.helpToolStripMenuItem.Name = "helpToolStripMenuItem";
            this.helpToolStripMenuItem.SettingsKey = "Form1.helpToolStripMenuItem";
            this.helpToolStripMenuItem.Text = "Help";
// 
// aboutToolStripMenuItem
// 
            this.aboutToolStripMenuItem.DoubleClickEnabled = true;
            this.aboutToolStripMenuItem.Name = "aboutToolStripMenuItem";
            this.aboutToolStripMenuItem.SettingsKey = "Form1.aboutToolStripMenuItem";
            this.aboutToolStripMenuItem.Text = "About";
// 
// statusStrip1
// 
            this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
            this.statusWebPanel2,
            this.statusWebPanel});
            this.statusStrip1.Location = new System.Drawing.Point(0, 404);
            this.statusStrip1.Name = "statusStrip1";
            this.statusStrip1.Padding = new System.Windows.Forms.Padding(0, 0, 12, 0);
            this.statusStrip1.Raft = System.Windows.Forms.RaftingSides.None;
            this.statusStrip1.TabIndex = 18;
            this.statusStrip1.Text = "statusStrip1";
// 
// statusWebPanel2
// 
            this.statusWebPanel2.BorderStyle = System.Windows.Forms.Border3DStyle.RaisedOuter;
            this.statusWebPanel2.Image = FormBrowser.MyResources.ie;
            this.statusWebPanel2.Name = "statusWebPanel2";
            this.statusWebPanel2.SettingsKey = "FormInternet.statusStripPanel1";
// 
// statusWebPanel
// 
            this.statusWebPanel.BorderStyle = System.Windows.Forms.Border3DStyle.SunkenOuter;
            this.statusWebPanel.Name = "statusWebPanel";
            this.statusWebPanel.SettingsKey = "FormInternet.statusStripPanel2";
            this.statusWebPanel.Text = "  Ready...";
            this.statusWebPanel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
// 
// splitContainer1
// 
            this.splitContainer1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
            this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
            this.splitContainer1.Location = new System.Drawing.Point(0, 104);
            this.splitContainer1.Name = "splitContainer1";
// 
// Panel1
// 
            this.splitContainer1.Panel1.Controls.Add(this.panel1);
// 
// Panel2
// 
            this.splitContainer1.Panel2.Controls.Add(this.WebBrowser1);
            this.splitContainer1.Size = new System.Drawing.Size(856, 300);
            this.splitContainer1.SplitterDistance = 288;
            this.splitContainer1.TabIndex = 19;
            this.splitContainer1.Text = "splitContainer1";
// 
// panel1
// 
            this.panel1.Controls.Add(this.listBox1);
            this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
            this.panel1.Location = new System.Drawing.Point(0, 0);
            this.panel1.Name = "panel1";
            this.panel1.Size = new System.Drawing.Size(284, 296);
            this.panel1.TabIndex = 0;
// 
// listBox1
// 
            this.listBox1.BackColor = System.Drawing.SystemColors.Control;
            this.listBox1.Dock = System.Windows.Forms.DockStyle.Fill;
            this.listBox1.FormattingEnabled = true;
            this.listBox1.Location = new System.Drawing.Point(0, 0);
            this.listBox1.Name = "listBox1";
            this.listBox1.Size = new System.Drawing.Size(284, 290);
            this.listBox1.TabIndex = 0;
// 
// WebBrowser1
// 
            this.WebBrowser1.Dock = System.Windows.Forms.DockStyle.Fill;
            this.WebBrowser1.Location = new System.Drawing.Point(0, 0);
            this.WebBrowser1.Name = "WebBrowser1";
            this.WebBrowser1.Size = new System.Drawing.Size(560, 296);
            this.WebBrowser1.TabIndex = 0;
            this.WebBrowser1.CanGoForwardChanged += new System.EventHandler(this.WebBrowser1_CanGoForwardChanged);
            this.WebBrowser1.ProgressChanged += new System.Windows.Forms.WebBrowserProgressChangedEventHandler(this.WebBrowser1_ProgressChanged);
            this.WebBrowser1.DocumentTitleChanged += new System.EventHandler(this.WebBrowser1_DocumentTitleChanged);
            this.WebBrowser1.CanGoBackChanged += new System.EventHandler(this.WebBrowser1_CanGoBackChanged);
            this.WebBrowser1.StatusTextChanged += new System.EventHandler(this.WebBrowser1_StatusTextChanged);
// 
// FormInternet
// 
            this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
            this.ClientSize = new System.Drawing.Size(856, 423);
            this.Controls.Add(this.splitContainer1);
            this.Controls.Add(this.toolStrip2);
            this.Controls.Add(this.toolStrip1);
            this.Controls.Add(this.menuStrip1);
            this.Controls.Add(this.statusStrip1);
            this.Name = "FormInternet";
            this.Text = "ZeBrowser";
            this.toolStrip2.ResumeLayout(false);
            this.toolStrip1.ResumeLayout(false);
            this.menuStrip1.ResumeLayout(false);
            this.statusStrip1.ResumeLayout(false);
            this.splitContainer1.Panel1.ResumeLayout(false);
            this.splitContainer1.Panel2.ResumeLayout(false);
            this.splitContainer1.ResumeLayout(false);
            this.panel1.ResumeLayout(false);
            this.ResumeLayout(false);
            this.PerformLayout();

        }

	#endregion

		#region Address bar

		// Navigates to the URL in the address text box when 
		// the ENTER key is pressed in the text box.
		private void TextBoxAddress_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
		{
			if (e.KeyCode == System.Windows.Forms.Keys.Enter &&
				!this.ComboBoxAddress.Text.Equals(""))
			{
				this.WebBrowser1.Navigate(this.ComboBoxAddress.Text);
			}
		}

		// Navigates to the URL in the address text box when 
		// the Go button is clicked.
		private void ButtonGo_Click(System.Object sender, System.EventArgs e)
		{
			if (!this.ComboBoxAddress.Text.Equals(""))
			{
				this.WebBrowser1.Navigate(this.ComboBoxAddress.Text);
				this.listBox1.Items.Add(this.ComboBoxAddress.Text);
			}
		}

		// Updates the URL in TextBoxAddress upon navigation.
		private void WebBrowser1_Navigated(object sender,
			System.Windows.Forms.WebBrowserNavigatedEventArgs e)
		{
			this.ComboBoxAddress.Text = this.WebBrowser1.Url;
		}

	#endregion

		#region Buttons

		// Navigates WebBrowser1 to the previous page in history.
		private void BackButton_Click(System.Object sender,
			System.EventArgs e)
		{
			this.WebBrowser1.GoBack();
		}

		// Disables the Back button at the beginning of navigation history.
		private void WebBrowser1_CanGoBackChanged(System.Object sender,
			System.EventArgs e)
		{
			this.BackButton.Enabled = this.WebBrowser1.CanGoBack;
		}

		// Navigates WebBrowser1 to the next page in history.
		private void ButtonForward_Click(System.Object sender,
			System.EventArgs e)
		{
			this.WebBrowser1.GoForward();
		}

		// Disables the Forward button at the end of navigation history.
		private void WebBrowser1_CanGoForwardChanged(System.Object sender,
			System.EventArgs e)
		{
			this.ForwardButton.Enabled = this.WebBrowser1.CanGoForward;
		}

		// Halts the current navigation and any sounds or animations on 
		// the page.
		private void ButtonStop_Click(System.Object sender,
			System.EventArgs e)
		{
			this.WebBrowser1.Stop();
		}

		// Reloads the current page.
		private void ButtonRefresh_Click(System.Object sender,
			System.EventArgs e)
		{
			// Skip refresh if about:blank is loaded to avoid removing
			// content specified by the DocumentText property.
			if (!this.WebBrowser1.Url.Equals("about:blank"))
			{
				this.WebBrowser1.Refresh();
			}
		}

		// Navigates WebBrowser1 to the home page of the current user.
		private void ButtonHome_Click(System.Object sender,
			System.EventArgs e)
		{
			this.WebBrowser1.GoHome();
		}

		// Navigates WebBrowser1 to the search page of the current user.
		private void ButtonSearch_Click(System.Object sender,
			System.EventArgs e)
		{
			this.WebBrowser1.GoSearch();
		}

		// Prints the current document using the current print settings.
		private void ButtonPrint_Click(System.Object sender,
			System.EventArgs e)
		{
			this.WebBrowser1.Print();
		}

	#endregion

		#region StatusBar
		// Updates StatusWebPanel with the current browser status text.
		private void WebBrowser1_StatusTextChanged(object sender,
			System.EventArgs e)
		{
			this.statusWebPanel.Text = WebBrowser1.StatusText;
		}
	#endregion

		#region Title
		// Updates the title bar with the current document title.
		private void WebBrowser1_DocumentTitleChanged(object sender,
			System.EventArgs e)
		{
			this.Text = WebBrowser1.DocumentTitle;
		}
	#endregion

		#region Progress bar
		// Update the progress bar while loading de page
		private void WebBrowser1_ProgressChanged(object sender, WebBrowserProgressChangedEventArgs e)
		{
			progressBar.Value = (int)(e.CurrentProgress * 100 / e.MaximumProgress );
			if(progressBar.Maximum == progressBar.Value)
			{
				progressBar.Value = 0;
			}
		}
		#endregion
	}
}
#endregion

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions