跟着視頻用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再回來解決……