图片路径:
picSrc="http://www.cars.com/manage/"+str[3];pb.Image=????这里如何写?

解决方案 »

  1.   

    pb.Image = Image.FromFile(picSrc);
      

  2.   

    pb.Image = Image.FromFile(picSrc);调试这行出错了
      

  3.   

    未处理的“System.ArgumentException”类型的异常出现在 mscorlib.dll 中。其他信息: 不支持 URI 格式。
      

  4.   

    抱歉,没看清picSrc="http://www.cars.com/manage/"+str[3];
    string name = "test" + picSrc.Substring(picSrc.LastIndexOf('.'));
    System.Net.WebClient wc = new System.Net.WebClient();
    wc.DownloadFile(picSrc, name);
    pb.Image = Image.FromFile(name);
      

  5.   

    可以用ImageLocation加载this.pictureBox1.ImageLocation = "http://www.baidu.com/img/logo.gif";
      

  6.   

    没有ImageLocation 需要引用什么?
      

  7.   

    winform里没有ImageLocation 属性
      

  8.   

    to:752(凉开水)这样基本可能,不过它会下载一个文件(test.jpg)到本机上,这个不重要但是当我浏览下一条记录会出错,我加了wc.Dispose();也不起作用System.Net.WebException: 在 WebClient 请求期间发生异常。 ---> System.IO.IOException: 该进程无法访问文件“E:\C#\mygrid\bin\Debug\test.JPG”,因为该文件正由另一进程使用。
      

  9.   

    picSrc="http://www.cars.com/manage/"+str[3];string strFileName = "test" + picSrc.Substring(picSrc.LastIndexOf('.'));
    System.Net.WebClient wc = new System.Net.WebClient();
    wc.DownloadFile(picSrc, strFileName);wc.Dispose();

    pb.Image = Image.FromFile(strFileName);
      

  10.   

    换成下面的试试:
    System.IO.Stream stream = wc.OpenRead(picSrc);
    this.pictureBox2.Image = Image.FromStream(stream)
    stream.Close();