
用的是绑定的数据源,想把图片从里面直接读出来,显示到picturebox控件,不知道哪里出的问题显示不出来,也不报错。
privatevoidcategoriesBindingSource_CurrentChanged(objectsender,EventArgse)
{
if(_imageBitmap!=null)
{
_imageBitmap.Dispose();
}
DataRowViewrowView=(DataRowView)categoriesBindingSource.Current;
NorthwindDataSet.CategoriesRowrow=(NorthwindDataSet.CategoriesRow)rowView.Row;

byte[]b=(byte[])row.Picture;
if(b.Length>0)
{
System.IO.MemoryStreamstream=newSystem.IO.MemoryStream(b,true);
stream.Write(b,0,b.Length);
pictureBox1.Image=newBitmap(stream);
stream.Close();
}
}

}
stream.Write(b,0,b.Length);
去掉试试
你把byte保存成文件看看..能不能用看图工具打开..可能你的byte[]损坏了.
MemoryStreamMS=newMemoryStream((Byte[])row.Picture);
ImagePhoto=Image.FromStream(MS,true);
pictureBox1.Image=Photo;
图片没有损坏,浏览的时候可以直接看到。picturebox1显示图片试了以上所有方法,还是出不来。picturebox1显示图片
“System.Drawing.Image”并不包含“FromStream”的定义
Image对象是哪里,我这段程序用在WM5.0上面在。
本文来自电脑杂谈,转载请注明本文网址:
https://www.pc-fly.com/a/jisuanjixue/article-75504-1.html
苏联当初的忘我好也是先警告后撞击的
让它们去赚大钱吧
不用转了