显示资源中的图像 [英] Displaying Image from resource

查看:70
本文介绍了显示资源中的图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我需要显示.resx文件中的图像.我尝试使用下面指定的代码,但不起作用.

Hi, I need to display an image from the .resx file. I tried using the code specified below but not working.

image1.Source = ResourcesFile.SaveImage;



但这会引发错误
无法将类型"System.Drawing.Bitmap"隐式转换为"System.Windows.Media.ImageSource



but it is throwing error
Cannot implicitly convert type ''System.Drawing.Bitmap'' to ''System.Windows.Media.ImageSource

推荐答案

请参见MSDN论坛上的以下主题:

http://social.msdn.microsoft.com /forums/zh-CN/wpf/thread/16bce8a4-1ee7-4be9-bd7f-0cc2b0f80cf0/ [
See this thread on MSDN forums:

http://social.msdn.microsoft.com/forums/en-US/wpf/thread/16bce8a4-1ee7-4be9-bd7f-0cc2b0f80cf0/[^]

Try the answer given by Ashish Shetty first, and if that does not help you scroll down to cornydinca''s response.


这篇关于显示资源中的图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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