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;
~~
这样都不对呀,望高手指点一二~~
顶的也散分,解决马上结帖

解决方案 »

  1.   

    img.Soure=image.Source; 行不?
      

  2.   

    System.Drawing.Image没有Source这个属性的
      

  3.   

    哦,呵呵,不行,我得装个环境在我电脑上了!
    那有没有img.DataContext = image;?
    算了,等我安装一个试试吧,先up~~~
      

  4.   

    我搞定了,分享出来:using (System.Drawing.Bitmap bitmap = new System.Drawing.Bitmap(image))
                          {
                              BitmapSource bitmapSource = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(
                                  bitmap.GetHbitmap(),
                                  IntPtr.Zero,
                                  Int32Rect.Empty,
                                  BitmapSizeOptions.FromEmptyOptions());                          img.Source = bitmapSource;
                          }