WPF 之 后台设置Image的Souce

时间:2016-06-14 15:51:20   收藏:0   阅读:522

  后台动态设置Image的Souce。

方法一:

BitmapImage imgSource = new BitmapImage(new Uri("location",UriKind.Relative));

Image image = new Image();

image.Souce = imgSource;

 

方法二:

MemoryStream ms = new MemoryStream()

----初始化ms------

BitmapImage imgSource = new BitmapImage();

imgSouce.BeginInit();

imgSouce.StreamSouce = new MemoryStream(ms.ToArray());

imgSouce.EndInit();

 

Image image = new Image();

image.Souce = imgSource;

 

原文:http://www.cnblogs.com/xinaixia/p/5584091.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!