// Navigates to the URL in the address box when
// the ENTER key is pressed while the ToolStripTextBox has focus.
private void toolStripTextBox1_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
{
Navigate(toolStripTextBox1.Text);
}
} // Navigates to the URL in the address box when
// the Go button is clicked.
private void goButton_Click(object sender, EventArgs e)
{
Navigate(toolStripTextBox1.Text);
} // Navigates to the given URL if it is valid.
private void Navigate(String address)
{
if (String.IsNullOrEmpty(address)) return;
if (address.Equals("about:blank")) return;
if (!address.StartsWith("http://")) address = "http://" + address;
try
{
webBrowser1.Navigate(new Uri(address));
}
catch (System.UriFormatException)
{
return;
}
} // Updates the URL in TextBoxAddress upon navigation.
private void webBrowser1_Navigated(object sender,
WebBrowserNavigatedEventArgs e)
{
toolStripTextBox1.Text = webBrowser1.Url.ToString();
} private void Form1_Load(object sender, EventArgs e)
{
this.toolStripTextBox1.Text = "www.jlthjy.com";
} private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
textBox1.Text = webBrowser1.DocumentText;
}
// the ENTER key is pressed while the ToolStripTextBox has focus.
private void toolStripTextBox1_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
{
Navigate(toolStripTextBox1.Text);
}
} // Navigates to the URL in the address box when
// the Go button is clicked.
private void goButton_Click(object sender, EventArgs e)
{
Navigate(toolStripTextBox1.Text);
} // Navigates to the given URL if it is valid.
private void Navigate(String address)
{
if (String.IsNullOrEmpty(address)) return;
if (address.Equals("about:blank")) return;
if (!address.StartsWith("http://")) address = "http://" + address;
try
{
webBrowser1.Navigate(new Uri(address));
}
catch (System.UriFormatException)
{
return;
}
} // Updates the URL in TextBoxAddress upon navigation.
private void webBrowser1_Navigated(object sender,
WebBrowserNavigatedEventArgs e)
{
toolStripTextBox1.Text = webBrowser1.Url.ToString();
} private void Form1_Load(object sender, EventArgs e)
{
this.toolStripTextBox1.Text = "www.jlthjy.com";
} private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
textBox1.Text = webBrowser1.DocumentText;
}
解决方案 »
- win7下 picturebox(VS2010)上的图片实现 多点触控 放大缩小功能
- 关于SqlDataReader的IndexOutOfRangeException问题
- splitcontainer Panel2 问题
- Properties.Settings.Default的问题
- 关于winform的datetimePcker的问题(Vs2008)
- 在c#中,怎样对treeview接点的保存,读取
- 调查一下用 C#.Net在北京3.5K的工资的有多少?
- 下面程序出现了一个错误,各位CSDN路过的朋友能否帮我看一下,我将以为数不多的分数相送。
- 问个小问题!!!!!!!!!!!!!!
- 高分求救~
- C#如何捕获打印机缺纸事件??
- winform datagrid processcmdkey
textBox1.Text = sr.ReadToEnd();