public string GetWebPageResponse(string uriArg)
{
System.IO.Stream responseStream = System.Net.WebRequest.Create(uriArg).GetResponse().GetResponseStream();
System.IO.StreamReader reader = new System.IO.StreamReader(responseStream);
return reader.ReadToEnd();
}
private void button1_Click(object sender, EventArgs e)
{
new System.Threading.Thread(delegate()
{
string strHtml = GetWebPageResponse(http://www.111com.net);
// 后台执行部分
this.Invoke((EventHandler)delegate
{
richTextBox1.Text = strHtml;
// 操作UI部分
});
}).Start();
}
|