在WPF中使用Image控件显示System.Drawing.Bitmap [英] Using Image control in WPF to display System.Drawing.Bitmap

查看:33
本文介绍了在WPF中使用Image控件显示System.Drawing.Bitmap的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将内存中的 Bitmap 对象分配给 WPF 中的 Image 控件?

How do I assign an in-memory Bitmap object to an Image control in WPF ?

推荐答案

您可以使用图像的 Source 属性.试试这个代码...

You can use the Source property of the image. Try this code...

ImageSource imageSource = new BitmapImage(new Uri("C:\FileName.gif"));

image1.Source = imageSource;

这篇关于在WPF中使用Image控件显示System.Drawing.Bitmap的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆