跟着视频用vs2013写了个下载图片的程序,但是出了问题,由于还没有正式开始学习C#,所以先记录下错误,留待以后解决
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Net;
namespace picturedownload
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void buttonSend_Click(object sender, EventArgs e)
{
WebClient client = new WebClient();
client.DownloadFile(textUrl.Text,"download//mybook1.jpg");
label1.Text = "成功下载!";
picImg.Image = Image.FromFile("dowmload//mybook1.jpg");//出错点,暂时找不出错误原因
}
private void label1_Click(object sender, EventArgs e)
{
}
}
}
问题:图片能下载,但是无法在窗体内显示。待以后深入学习csharp再回来解决……