vs2013—未解決問題—編寫簡單的圖片下載程序

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

出現的問題

將出錯代碼行註釋掉後的結果

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章