本文介绍了想在wpf中显示图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在wpf图片框中显示图片。该图像在数据库中采用字节格式。我将如何显示该图像。请帮帮我。
i want to show image in wpf image box. that image is in byte format at database. how will i show that image. please help me out.
推荐答案
byte[] b;
//b=memStream.GetBuffer();
b = System.IO.File.ReadAllBytes(openfile.FileName);
MemoryStream byteStream = new MemoryStream(b);
BitmapImage image = new BitmapImage();
image.BeginInit();
image.StreamSource = byteStream;
image.EndInit();
image1.Source = image;
<image name="image4" stretch="None" source="C:\Users\smevis\Desktop\WpfApplication1\mn.png" isenabled="True" stretchdirection="Both" />
这篇关于想在wpf中显示图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!