我如何...将文件添加到vb .net资源文件 [英] How do I...add files to vb .net resource file
本文介绍了我如何...将文件添加到vb .net资源文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
您好,
我有一些位图文件,想要将它们添加到VB .Net项目中的文件,一个资源文件,所以我调用资源文件并使用位图,我不知道我想将它们作为单个位图添加到项目中,我想有一种方法可以做到这一点。
解决方案
如果将它们作为资源存储在一个单独的项目中 - 类库是好的 - 然后您需要做的就是在代码中引用程序集然后:
Dim im 作为 Image = Image.FromStream(theAsmbly_GetManifestResourceStream( resourcename))
例如:
Dim theAssembly 作为 Assembly = Assembly.LoadFrom( D:\ Temp \ MyResources.dll)
Dim im As Image = Image.FromStream(theAssembly.GetManifestResourceStream( MyResources.Resources.Images.Buttons.Abort.png))
如果您不确定它们将被称为什么,那么:
Dim 名称作为 字符串()= theAssembly.GetManifestResourceNames()将为您提供所有这些。
Hello,
I have some bitmap files and want to add them to a file in a VB .Net project, a resource file so I call the resource file and use the bitmaps, I don't want toadd them to the project as single bitmaps, I suppose there is a way to do this.
解决方案
If you store them as resources within a separate project - a class library is good - then all you have to do is reference the assembly in your code and then:
Dim im As Image = Image.FromStream (theAssembly.GetManifestResourceStream ("resourcename"))
For example:
Dim theAssembly As Assembly = Assembly.LoadFrom("D:\Temp\MyResources.dll") Dim im As Image = Image.FromStream(theAssembly.GetManifestResourceStream("MyResources.Resources.Images.Buttons.Abort.png"))
If you aren't sure exactly what they will be called then:
Dim names As String() = theAssembly.GetManifestResourceNames()will get them all for you.
这篇关于我如何...将文件添加到vb .net资源文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文