110,539
社区成员
发帖
与我相关
我的任务
分享
object imgControl = control.FindName("Image1");
Image img = imgControl as Image;
if (img != null)
{
if (imageBase == null)
{
img.Source = null;
img.Stretch = Stretch.Uniform;
}
else
{
img.Source = null;
byte[] imgByte = Convert.FromBase64String(imageBase);
BitmapImage bitImage = new BitmapImage();
bitImage.BeginInit();
bitImage.CacheOption = BitmapCacheOption.OnLoad;
using (MemoryStream ms1 = new MemoryStream(imgByte))
{
bitImage.StreamSource = ms1;
bitImage.EndInit();
//bitImage.Freeze();
ms1.Dispose();
ms1.Close();
}
img.Source = bitImage;
img.Stretch = Stretch.Uniform;
}
}
object imgControl = control.FindName("Image1");
Image imgImage = imgControl as Image;
if (imgImage != null)
{
imgImage.Source = null;
}