private void UpdatePicture() { if (this.pictureBox1.InvokeRequired) { UpdatePictureDelegate resetTextBoxDelegate = UpdatePicture; this.pictureBox1.Invoke(resetTextBoxDelegate, new object[] { }); } else { this.toolStripStatusLabel1.Text = "获取中"; int ret = DownloadFile("http://" + this.textBox1.Text + "/1.jpg", @"1.jpg", this.toolStripProgressBar1, this.toolStripStatusLabel1); if (ret == 0) { FileStream fs = File.OpenRead(@"1.jpg"); this.pictureBox1.Image = Image.FromStream(fs); fs.Close(); this.toolStripStatusLabel1.Text = "获取成功"; this.toolStripProgressBar1.Visible = false; } else { this.toolStripStatusLabel1.Text = "获取失败"; } } }
private void UpdatePicture() { if (this.pictureBox1.InvokeRequired) { UpdatePictureDelegate resetTextBoxDelegate = UpdatePicture; this.pictureBox1.Invoke(resetTextBoxDelegate, new object[] { }); } else { DownloadFile("http://" + this.textBox1.Text + "/1.jpg", @"1.jpg", this.progressBar1, this.label3); //this.pictureBox1.Image = Image.FromFile(@"1.jpg"); } }