我想用 c#语言编写一个浏览器,具体的功能就和 微软的ie相似,请问该如何下手,谁有这个代码 借小弟一看可否?
QQ;31985632 mail:linxz1002@163.com
里面的都看不懂啊,我是刚开始C#的,不过我已经开始学控件了
以后希望大家多帮帮忙啊
using System ;
using System.Drawing ;
using System.Collections ;
using System.ComponentModel ;
using System.Windows.Forms ;
using System.Data ;
using AxSHDocVw ;
public class Form1 : Form
{
private ToolBar toolBar1 ;
private ToolBarButton tb1 ;
private ToolBarButton tb2 ;
private ToolBarButton tb3 ;
private ToolBarButton tb4 ;
private ToolBarButton tb5 ;
private Label label1 ;
private TextBox textBox1 ;
private Button button1 ;
private AxWebBrowser axWebBrowser1 ;
private System.ComponentModel.Container components = null ;
public Form1 ( )
{
InitializeComponent ( ) ;
}
//清除程序中使用过的资源
protected override void Dispose ( bool disposing )
{
if ( disposing )
{
if ( components != null )
{
components.Dispose ( ) ;
}
}
base.Dispose ( disposing ) ;
}
//初始化窗体中的各个组件
private void InitializeComponent ( )
{
tb1 = new ToolBarButton ( ) ;
tb2 = new ToolBarButton ( ) ;
tb3 = new ToolBarButton ( ) ;
toolBar1 = new ToolBar ( ) ;
tb4 = new ToolBarButton ( ) ;
tb5 = new ToolBarButton ( ) ;
button1 = new Button ( ) ;
textBox1 = new TextBox ( ) ;
axWebBrowser1 = new AxWebBrowser ( ) ;
label1 = new Label ( ) ;
( ( System.ComponentModel.ISupportInitialize ) ( this.axWebBrowser1 ) ).BeginInit ( ) ;
this.SuspendLayout ( ) ;
tb1.Text = "后退" ;
tb2.Text = "前进" ;
tb3.Text = "停止" ;
tb4.Text = "刷新" ;
tb5.Text = "主页" ;
toolBar1.Appearance = ToolBarAppearance.Flat ;
toolBar1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle ;
//在工具栏中加入按钮
toolBar1.Buttons.Add ( tb1 ) ;
toolBar1.Buttons.Add ( tb2 ) ;
toolBar1.Buttons.Add ( tb3 ) ;
toolBar1.Buttons.Add ( tb4 ) ;
toolBar1.Buttons.Add ( tb5 ) ;
toolBar1.DropDownArrows = true ;
toolBar1.Name = "toolBar1" ;
toolBar1.ShowToolTips = true ;
toolBar1.Size = new System.Drawing.Size ( 612 , 39 ) ;
toolBar1.TabIndex = 0 ;
toolBar1.ButtonClick += new ToolBarButtonClickEventHandler ( toolBar1_ButtonClick ) ;
//定位“转到”按钮组件与窗体的上、右边框保持一致
button1.Anchor = ( AnchorStyles.Top | AnchorStyles.Right ) ;
button1.DialogResult = DialogResult.OK ;
button1.Location = new System.Drawing.Point ( 544 , 45 ) ;
button1.Name = "button1" ;
button1.Size = new System.Drawing.Size ( 40 , 23 ) ;
button1.TabIndex = 3 ;
button1.Text = "转到" ;
button1.Click += new System.EventHandler ( button1_Click ) ;
//定位地址文本框组件与窗体的上、左、右边框保持一致
textBox1.Anchor = ( ( AnchorStyles.Top | AnchorStyles.Left )
| AnchorStyles.Right ) ;
textBox1.Location = new System.Drawing.Point ( 64 , 47 ) ;
textBox1.Name = "textBox1" ;
textBox1.Size = new System.Drawing.Size ( 464 , 21 ) ;
textBox1.TabIndex = 2 ;
textBox1.Text = "" ;
//定位浏览器组件与窗体的上、下、左、右边框保持一致
axWebBrowser1.Anchor = ( ( ( AnchorStyles.Top | AnchorStyles.Bottom )
| AnchorStyles.Left )
| AnchorStyles.Right ) ;
axWebBrowser1.Enabled = true ;
axWebBrowser1.Location = new System.Drawing.Point ( 0 , 72 ) ;
axWebBrowser1.Size = new System.Drawing.Size ( 608 , 358 ) ;
axWebBrowser1.TabIndex = 4 ;
label1.Location = new System.Drawing.Point ( 16 , 48 ) ;
label1.Name = "label1" ;
label1.Size = new System.Drawing.Size ( 48 , 16 ) ;
label1.TabIndex = 1 ;
label1.Text = "地址:" ;
this.AutoScaleBaseSize = new System.Drawing.Size ( 6 , 14 ) ;
this.ClientSize = new System.Drawing.Size ( 612 , 433 ) ;
this.Controls.Add ( axWebBrowser1 ) ;
this.Controls.Add ( button1 ) ;
this.Controls.Add ( textBox1 ) ;
this.Controls.Add ( label1 ) ;
this.Controls.Add ( toolBar1 ) ;
this.FormBorderStyle = FormBorderStyle.FixedSingle ;
this.Name = "Form1" ;
this.Text = "visual C#做浏览器" ;
( ( System.ComponentModel.ISupportInitialize ) ( this.axWebBrowser1 ) ).EndInit ( ) ;
this.ResumeLayout ( false ) ;
}