Windows窗体应用程序中的ImageLocation属性不起作用. [英] ImageLocation property in windows forms app not working.

查看:223
本文介绍了Windows窗体应用程序中的ImageLocation属性不起作用.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用C#构建Windows窗体应用程序.我使用了一个图片框(名称:pictureBox1),并且我试图将图像放在框内.当我给出本地路径(即硬盘上图像文件的路径)时,程序运行正常.
例如pictureBox1.ImageLocation ="C:\\ test.jpg";

但是当我提供如下网址时
pictureBox1.ImageLocation ="http://dceqc.files.wordpress.com/2009/06/earth-globe-browse2.jpg";

则图片不会出现在图片框中.
可能是什么问题?
我安装了.net 1.1、2.0(SP2),3.0和3.5版本.
我的网络连接正常,并且已通过禁用防火墙并启用了它来测试了此程序.....但无济于事.
请帮忙.

更新1:
当我使用pictureBox1.Load(http://dceqc.files.wordpress.com/2009/06/earth-globe-browse2.jpg)
我收到异常(407)需要代理身份验证".我该如何解决?

I''m building a windows forms app using C#. I have used a picture box (name : pictureBox1) and i''m trying to place images within the box. When i give a local path (i.e path to a image file on my hard-disk), then the program functions fine.
e.g pictureBox1.ImageLocation = "C:\\test.jpg";

But when i give a URL like the following
pictureBox1.ImageLocation = "http://dceqc.files.wordpress.com/2009/06/earth-globe-browse2.jpg";

then the picture does not appear in the picture box.
What can be the problem?
I have .net versions 1.1, 2.0 (SP2), 3.0 and 3.5 installed.
I have a working internet connection and i have tested this program by disabling the firewall and also by enabling it.....but to no avail.
Please help.

Update 1:
When i use pictureBox1.Load(http://dceqc.files.wordpress.com/2009/06/earth-globe-browse2.jpg)
i get an exception "(407) Proxy Authentication Required". How do i work around this?

推荐答案

1.图片是否存在于该URL?您可以在Web浏览器中键入该URL并获取图像吗?

2.您是否尝试过pictureBox1.Load("http://dceqc.files.wordpress.com/2009/06/earth-globe-browse2.jpg")?

[更新]
您收到的407错误表示您无权直接访问该文件.您必须登录到wordpress以获得身份验证凭据,该身份验证凭据已从wordpress的登录服务器传递到文件服务器.您需要将图像文件托管在其他位置.
1. Does the image exist at that URL? Can you type that URL into your web browser and get the image?

2. Have you tried pictureBox1.Load("http://dceqc.files.wordpress.com/2009/06/earth-globe-browse2.jpg")?

[Update]
The 407 error you are getting means you don''t have direct access to that file. You have to log-in to wordpress to get authentication credentials which are passed from wordpress''s login server to the file server. You need to host the image file somewhere else.


是的,URL确实存在.
根据您的建议,当我尝试使用pictureBox1.Load("http://dceqc.files.wordpress.com/2009/06/earth-globe-browse2.jpg");

我收到了WebExeception远程服务器返回错误:(407)要求代理身份验证."

这到底是什么意思.我该如何解决?
Yes, the URL does exist.
As per your advice, when i tried to use pictureBox1.Load("http://dceqc.files.wordpress.com/2009/06/earth-globe-browse2.jpg");

i got the WebExeception "The remote server returned an error: (407) Proxy Authentication Required."

What does this exactly mean. How do i work around this?


这篇关于Windows窗体应用程序中的ImageLocation属性不起作用.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆