FileStream filestream = File.OpenRead(@"C:\Users\Administrator\Desktop\queryHeaderImg.png");

BitmapImage image = new BitmapImage();
MemoryStream stream = new MemoryStream();

filestream.CopyTo(stream);

 

 

我开始将stream 赋值给BitmapImage 中的StreamSource 但是图片一直报错,

提示StreamSource 为null

 

查找资料 一定要要先初始货才能给StreamSource赋值。

 

bitmapImage.BeginInit();
bitmapImage.StreamSource = stream;
bitmapImage.EndInit();

相关文章:

  • 2021-09-14
  • 2022-12-23
  • 2021-07-12
  • 2022-12-23
  • 2021-12-06
  • 2021-12-12
  • 2021-11-15
  • 2022-12-23
猜你喜欢
  • 2022-03-03
  • 2022-12-23
  • 2021-06-25
  • 2022-12-23
  • 2021-12-10
  • 2022-12-23
相关资源
相似解决方案