System.Net.WebRequest request =
System.Net.WebRequest.Create(
"http://www.xxx.com/ms_masthead_ltr.gif");
System.Net.WebResponse response = request.GetResponse();
System.IO.Stream newStream =
response.GetResponseStream();
Bitmap bitmap2 = new Bitmap(newStream);
PictureBox1.Image = bitmap2;
…………
System.Net.WebRequest.Create(
"http://www.xxx.com/ms_masthead_ltr.gif");
System.Net.WebResponse response = request.GetResponse();
System.IO.Stream newStream =
response.GetResponseStream();
Bitmap bitmap2 = new Bitmap(newStream);
PictureBox1.Image = bitmap2;
…………
this . pictureBox1 . Image = srcBitmap2;
我也遇到了bitmap参数无效的情况,目前不知道为什么,正在解决当中.
怎么使用相对路径
?
我估计楼主的
Bitmap image = new Bitmap(newStream);
newStream 为null,可以检查一下.
你可以把图片放在程序的目录下然后用
string path=Application.StartupPath+"\\imgage\\2.bmp"——获取启动了应用程序的可执行文件的路径,不包括可执行文件的名称。
不是这个原因