如何使用 C# 在 WPF 中从 MemoryStream
获取 ImageSource
?或者将 MemoryStream
转换为 ImageSource
以在 wpf 中将其显示为图像?
最佳答案
using (MemoryStream memoryStream = ...)
{
var imageSource = new BitmapImage();
imageSource.BeginInit();
imageSource.StreamSource = memoryStream;
imageSource.EndInit();
// Assign the Source property of your image
image.Source = imageSource;
}
关于c# - 在 c# wpf 中从 Memorystream 获取图像源,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6588974/