
private void toolStripButton1_Click(object sender, EventArgs e)
{//前进
webBrowser1.GoBack();}
private void toolStripButton2_Click(object sender, EventArgs e)
{//后退
webBrowser1.GoForward();
}private void toolStripButton3_Click(object sender, EventArgs e)
{//刷新
webBrowser1.Refresh();
}private void toolStripButton6_Click(object sender, EventArgs e)
{//停止
webBrowser1.Stop();
}private void toolStripButton4_Click(object sender, EventArgs e)
{//主页
webBrowser1.GoHome();
}private void toolStripTextBox1_Click(object sender, EventArgs e)
{//地址栏 回车事件
toolStripTextBox1.Text ="";
}private void toolStripButton5_Click(object sender, EventArgs e)
{//转到
string adress = toolStripTextBox1.Text;
if (adress != "")
{
if (adress.StartsWith("http://"))
{
adress = "http://" + adress;
}
webBrowser1.Navigate(adress);} string title = webBrowser1.DocumentTitle;
if (title == "")
this.Text = adress;
else
this.Text = title;
//this.Text = webBrowser1.DocumentTitle;
}private void toolStripTextBox1_KeyPress(object sender, KeyPressEventArgs e)
{//回车键
if (e.KeyChar == (char)Keys.Enter)
{
string adress = toolStripTextBox1.Text;
if (adress != "")
{
if (adress.StartsWith("http://"))
{
adress = "http://" + adress;}
webBrowser1.Navigate(adress);
string title = webBrowser1.DocumentTitle;
if (title == "")
this.Text = adress;
else
this.Text = title;
}
}
}
原创文章转载请注明引自浩浩愁的博客! http://www.cone.cc/ 欢迎订阅浩浩愁的博客!。
Tags:net