我试图将图像追加到图像源,但在执行代码图像后不会显示在我的页面中。在wpf中将图像追加到image.source
代码:
Bitmap bmp = (Bitmap)data.img;
MemoryStream ms = new MemoryStream();
bmp.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
ms.Position = 0;
BitmapImage bi = new BitmapImage();
bi.BeginInit();
bi.StreamSource = ms;
bi.EndInit();
imgPhoto.Source = bi;
这是我要附加到imhPhoto.Source data.img规范。
它说'imgPhoto.Source.Metadata投掷类型System.NotSupportedException的异常'和图像不显示尚未.. – Saif
可以你看附图中的RawFormat?我认为这是主要问题,但我不知道如何让它知道格式 – Saif