如何在c#中找到资源文件中的图像路径 [英] How do I find image path from Resource file in c#

查看:287
本文介绍了如何在c#中找到资源文件中的图像路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我在myProject资源中有一个图像文件(即Properties.Resources.ch))

i想要获取此文件的路径



请帮助我,我是c新手#



- 谢谢你



-tushar

Hello all,

I have a image file in myProject Resource(i.e., Properties.Resources.ch))
i want to get path of this file

pls help me i am new in c#

-Thank you

-tushar

推荐答案

该文件在运行时不存在,因此您的问题不会产生任何问题感觉。



资源文件被编译成生成的可执行文件的结构。没有文件可以获取路径!
The file doesn't exist at runtime, so your question doesn't make any sense.

Resource files are compiled into structures into the resulting executable. There is no file to get the path to!


您可以按如下方式访问它们

you can access them as below
System.Drawing.Bitmap bitmap1 = myProject.Properties.Resources.Image01;



如果你需要获取路径,请查看以下答案

http://stackoverflow.com/a/14265535/2558060 [ ^ ]


这篇关于如何在c#中找到资源文件中的图像路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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