日期:2014-05-18 浏览次数:20984 次
private delegate void PicImage(); Thread th1; private void btn_Start1_Click(object sender, EventArgs e) { th1 = new Thread(new ThreadStart(StartTh1)); th1.Start(); ShowData();//费时的代码 } public void StartTh1() { BeginInvoke(new PicImage(ShowImge)); } public void ShowImge() { Bitmap bmp = new Bitmap(@"F:\WorkSpace\DONET\ForeignTrader\ForeignTrader\imgs\run.gif",true); this.pictureBox1.Image = bmp; this.pictureBox1.Refresh(); this.pictureBox1.Visible = true; } public void ShowData()//费时的代码 { string url = this.tb_url1.Text.Trim(); if (url.IndexOf(Uri.SchemeDelimiter) < 0) { url = string.Format("{0}{1}{2}",Uri.UriSchemeHttp,Uri.SchemeDelimiter,url); } string x = GetHtml(url); if (x.Contains("CSDN")) MessageBox.Show("true"); else MessageBox.Show("false"); this.pictureBox1.Visible = false; }