码迷,mamicode.com
首页 > Windows程序 > 详细

WPF 之 后台设置Image的Souce

时间:2016-06-14 15:52:24      阅读:607      评论:0      收藏:0      [点我收藏+]

标签:

  后台动态设置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;

 

WPF 之 后台设置Image的Souce

标签:

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!