using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;

namespace Web_Browser
{
	/// <summary>
	/// Summary description for Form1.
	/// </summary>
	public class Form1 : System.Windows.Forms.Form
	{
		private AxSHDocVw.AxWebBrowser axWebBrowser1;
		private System.Windows.Forms.TextBox txtAddress;
		private System.Windows.Forms.ToolBar toolBar1;
		private System.Windows.Forms.ToolBarButton tbbBack;
		private System.Windows.Forms.ToolBarButton tbbRefresh;
		private System.Windows.Forms.ToolBarButton tbbHome;
		private System.Windows.Forms.ToolBarButton tbbStop;
		private System.Windows.Forms.Label label1;
		private System.Windows.Forms.Button btnLoad;
		private System.Windows.Forms.ToolBarButton tbbForward;
		/// <summary>
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.Container components = null;

		public Form1()
		{
			//
			// Required for Windows Form Designer support
			//
			InitializeComponent();

			//
			// TODO: Add any constructor code after InitializeComponent call
			//
		}

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

		#region Windows Form Designer generated code
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
			System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Form1));
			this.axWebBrowser1 = new AxSHDocVw.AxWebBrowser();
			this.txtAddress = new System.Windows.Forms.TextBox();
			this.toolBar1 = new System.Windows.Forms.ToolBar();
			this.tbbBack = new System.Windows.Forms.ToolBarButton();
			this.tbbForward = new System.Windows.Forms.ToolBarButton();
			this.tbbRefresh = new System.Windows.Forms.ToolBarButton();
			this.tbbHome = new System.Windows.Forms.ToolBarButton();
			this.tbbStop = new System.Windows.Forms.ToolBarButton();
			this.label1 = new System.Windows.Forms.Label();
			this.btnLoad = new System.Windows.Forms.Button();
			((System.ComponentModel.ISupportInitialize)(this.axWebBrowser1)).BeginInit();
			this.SuspendLayout();
			// 
			// axWebBrowser1
			// 
			this.axWebBrowser1.Dock = System.Windows.Forms.DockStyle.Bottom;
			this.axWebBrowser1.Enabled = true;
			this.axWebBrowser1.Location = new System.Drawing.Point(0, 77);
			this.axWebBrowser1.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("axWebBrowser1.OcxState")));
			this.axWebBrowser1.Size = new System.Drawing.Size(448, 288);
			this.axWebBrowser1.TabIndex = 0;
			// 
			// txtAddress
			// 
			this.txtAddress.Location = new System.Drawing.Point(72, 48);
			this.txtAddress.Name = "txtAddress";
			this.txtAddress.Size = new System.Drawing.Size(288, 21);
			this.txtAddress.TabIndex = 7;
			this.txtAddress.Text = "";
			// 
			// toolBar1
			// 
			this.toolBar1.Appearance = System.Windows.Forms.ToolBarAppearance.Flat;
			this.toolBar1.Buttons.AddRange(new System.Windows.Forms.ToolBarButton[] {
																						this.tbbBack,
																						this.tbbForward,
																						this.tbbRefresh,
																						this.tbbHome,
																						this.tbbStop});
			this.toolBar1.DropDownArrows = true;
			this.toolBar1.Name = "toolBar1";
			this.toolBar1.ShowToolTips = true;
			this.toolBar1.Size = new System.Drawing.Size(448, 38);
			this.toolBar1.TabIndex = 8;
			this.toolBar1.ButtonClick += new System.Windows.Forms.ToolBarButtonClickEventHandler(this.toolBar1_ButtonClick);
			// 
			// tbbBack
			// 
			this.tbbBack.Text = "后退";
			// 
			// tbbForward
			// 
			this.tbbForward.Text = "前进";
			// 
			// tbbRefresh
			// 
			this.tbbRefresh.Text = "刷新";
			// 
			// tbbHome
			// 
			this.tbbHome.Text = "主页";
			// 
			// tbbStop
			// 
			this.tbbStop.Text = "停止";
			// 
			// label1
			// 
			this.label1.Location = new System.Drawing.Point(8, 48);
			this.label1.Name = "label1";
			this.label1.Size = new System.Drawing.Size(56, 24);
			this.label1.TabIndex = 9;
			this.label1.Text = "地址栏";
			// 
			// btnLoad
			// 
			this.btnLoad.Location = new System.Drawing.Point(368, 48);
			this.btnLoad.Name = "btnLoad";
			this.btnLoad.Size = new System.Drawing.Size(72, 24);
			this.btnLoad.TabIndex = 10;
			this.btnLoad.Text = "加载网页";
			this.btnLoad.Click += new System.EventHandler(this.btnLoad_Click);
			// 
			// Form1
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
			this.ClientSize = new System.Drawing.Size(448, 365);
			this.Controls.AddRange(new System.Windows.Forms.Control[] {
																		  this.btnLoad,
																		  this.label1,
																		  this.toolBar1,
																		  this.txtAddress,
																		  this.axWebBrowser1});
			this.Name = "Form1";
			this.Text = "我的浏览器";
			this.Load += new System.EventHandler(this.Form1_Load);
			((System.ComponentModel.ISupportInitialize)(this.axWebBrowser1)).EndInit();
			this.ResumeLayout(false);

		}
		#endregion

		/// <summary>
		/// The main entry point for the application.
		/// </summary>
		[STAThread]
		static void Main() 
		{
			Application.Run(new Form1());
		}

		private void toolBar1_ButtonClick(object sender, System.Windows.Forms.ToolBarButtonClickEventArgs e)
		{
			
				if ( e.Button == tbbBack )
				{
					axWebBrowser1.GoBack();
				}
				if ( e.Button == tbbForward )
				{
					axWebBrowser1.GoForward ();
				}
				if ( e.Button == tbbRefresh )
				{
					axWebBrowser1.Refresh();
				}
				if ( e.Button == tbbHome )
				{
					axWebBrowser1.GoHome();
				}
				if ( e.Button == tbbStop )
				{
					axWebBrowser1.Stop();
				}
			 
		}

		private void btnLoad_Click(object sender, System.EventArgs e)
		{
			System.Object nullObject = 0;
			string str = "";
			System.Object nullObjStr = str;
			Cursor.Current = Cursors.WaitCursor;
			axWebBrowser1.Navigate(txtAddress.Text, ref nullObject, ref nullObjStr, ref nullObjStr, ref nullObjStr);
			Cursor.Current = Cursors.Default;

		}

		private void Form1_Load(object sender, System.EventArgs e)
		{
		
		}
	}
}
