MemoryStream ms[0] = new MemoryStream((byte[])reader["image"]);
System.Drawing.Image image = System.Drawing.Image.FromStream(ms[1], true);
从数据库中如上所示将存在MSSQL数据库中的图片读出来后,如何放到WPF中Image控件上面?
Image img=(Image)image;
img.Soure=image;
~~
这样都不对呀,望高手指点一二~~
顶的也散分,解决马上结帖
System.Drawing.Image image = System.Drawing.Image.FromStream(ms[1], true);
从数据库中如上所示将存在MSSQL数据库中的图片读出来后,如何放到WPF中Image控件上面?
Image img=(Image)image;
img.Soure=image;
~~
这样都不对呀,望高手指点一二~~
顶的也散分,解决马上结帖
那有没有img.DataContext = image;?
算了,等我安装一个试试吧,先up~~~
{
BitmapSource bitmapSource = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(
bitmap.GetHbitmap(),
IntPtr.Zero,
Int32Rect.Empty,
BitmapSizeOptions.FromEmptyOptions()); img.Source = bitmapSource;
}