Synchronously download an image from URL

后端 未结 4 2038
离开以前
离开以前 2020-12-24 10:18

I just want to get a BitmapImage from a internet URL, but my function doesn\'t seem to work properly, it only return me a small part of the image. I know WebResponse is work

4条回答
  •  误落风尘
    2020-12-24 10:38

    Why not use System.Net.WebClient.DownloadFile?

    string url = @"http://www.google.ru/images/srpr/logo3w.png";
    string file = System.IO.Path.GetFileName(url);
    System.Net.WebClient cln = new System.Net.WebClient();
    cln.DownloadFile(url,file);
    

提交回复
热议问题