如何将图像放入.exe之外的单独DLL文件中 [英] How to put images into a seperate DLL file outside of .exe

查看:81
本文介绍了如何将图像放入.exe之外的单独DLL文件中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我无法将所有图像放入单独的文件中,那么我将拥有一个15mb的.exe文件。无论是.dat,.db还是.dll文件。没关系。


我已经用Google搜索了几次这个问题。我找到的唯一的东西是......

So Im going to have a 15mb .exe file if I can''t manage to get all the images put into a seperate file. Whether its a .dat, .db, or .dll file. It don''t matter.

I''ve googled for this question a few times. The only thing I''ve found is...


为了将图像放入你需要的dll中以下内容

右键单击图像 - >属性 - >现在内容的内容把图像作为嵌入资源,这就是:-)
in order to put an image inside a dll you need todo the following
right click on the image-> Properties -> now insted of Content put the image as Embeded Resource and thats it :-)



那对我不起作用,而且我对语言很新使用Visual Studio '05。


所以有什么想法吗?

That did not work for me, and I''m pretty new to the language and using Visual Studio ''05.

So any ideas please?

推荐答案

它对我来说很好...这里我做了什么。


1)创建了一个Windows窗体的测试项目

2)创建了一个类库的测试项目

3)右键单击类库并选择添加 - >现有项目

4)选择我想要使用的图像

5 )单击图像以显示它的属性

6)在Build Action下,我选择了Embedded Resource

7)在我的类库中,我做了以下操作。 。

It worked fine for me... here''s what I did.

1) Created a test project that was a windows form
2) Created a test project that was a class library
3) Right-clicked on the class library and selected Add->Existing Item
4) Selected the image I wanted to use
5) Clicked the image to bring up the properties for it
6) Under Build Action, I selected Embedded Resource
7) In my class library, I did the following...

展开 | 选择 | Wrap | 行号


Ty,详细介绍了您的流程。现在只有1个问题,当我转到添加参考时我找不到类库,我无法构建这个东西,因为我不能把使用System.Drawing; ,我假设因为它是一个类库而不是Windows应用程序。


编译器给我的错误是类型或命名空间名称''绘图''在命名空间''系统'中不存在(你是否遗漏了)程序集引用?)"
Ty for the detailed outline of your process. Only 1 problem now, when I go to "Add Reference" I can''t find the class library, and I can not build the thing because I can''t put using System.Drawing; in, im assume because its a class library and not a Windows Application.

The error the compiler gives me is "The type or namespace name ''Drawing'' does not exist in the namespace ''System'' (are you missing an assembly reference?)"


类库不是来自添加引用,而是来自添加新项目。右键单击解决方案,然后选择添加 - > 新建项目。除非你的意思是你不能从你的主表单中添加对你的类库的引用,在这种情况下见下面...


另外,你需要添加对系统的引用。在绘制using语句之前绘制。在需要添加引用的项目中,右键单击引用并选择添加引用


如果你想要在解决方案中添加对项目的引用,完成上述操作后,单击项目选项卡。它应该在那里:)
Class library doesn''t come from adding a reference, it comes from adding a new project. Right click your Solution and select Add->New Project. Unless you mean you can''t add a reference to your class library from your main form, in which case see below...

Also, you need to add a reference to System.Drawing before you can put a using statement in. In the project that needs the reference added, right-click references and select Add Reference.

If you want to add a reference to a project in your solution, once you''ve done the above, click the Projects tab. It should be in there :)


这篇关于如何将图像放入.exe之外的单独DLL文件中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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