关于用C#建一个简单的浏览器

来源:百度知道 编辑:UC知道 时间:2024/06/08 08:12:43
编了个简单的程序,可是运行的时候出现两个问题:
1.浏览器的工具栏部分五个按键全都按得到却看不到
2.工具栏的按键按下之后会出现错误
以下是程序:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication2
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void toolBar1_ButtonClick(object sender, ToolBarButtonClickEventArgs e)
{
if (e.Button == tbbBack)
{
axWebBrowser1.GoBack();
}
if (e.Button == tbbForward)
{
axWebBrowser1.GoForward();
}
if (e.Button == tbbRefresh)
{
axWebBrowser1.Refresh();

楼主没说出什么错误,所以不好回答,所以给你段C#实现web浏览器的代码看下吧
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;
namespace Web浏览器
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Navigate(string address)
{
if (String.IsNullOrEmpty(address))
return;
if (address.Equals("about:blank")) return;
if (!address.StartsWith("http://")) address = "http://" + address;
try {
Cursor.Current = Cursors.WaitCursor; webBrowser1.Navigate(new Uri(address));
}
catch (System.UriFormatException)
{ return; }
finally { Cursor.Current = Cursors.Default; }
}
private void Form1_Load(object sender, EventArgs e)
{
toolStrip1.ImageList = imageList1;
tbBack.ImageInd