从VS 05中的资源设置应用程序图标

时间:2022-11-27 19:37:25

I know I can add a icon to the Resources.resx file of a project and then reference that icon from within the code.

我知道我可以在项目的Resources.resx文件中添加一个图标,然后从代码中引用该图标。

How do I set the icon of the entire EXE from the resources? All I see is a place to browse for another file. I want to use the current icon file that I have in my resources and not have to have a duplicate file in my project...

如何从资源中设置整个EXE的图标?我只看到一个浏览另一个文件的地方。我想使用我的资源中的当前图标文件,而不是在我的项目中有一个重复的文件...

thanks

2 个解决方案

#1


2  

The way that the adding of an application icon is that you must select it from the local file system, and then it is embedded into the application at build time. As far as I know it is not possible to have it first pull from a resource file.

添加应用程序图标的方式是必须从本地文件系统中选择它,然后在构建时将其嵌入到应用程序中。据我所知,不可能首先从资源文件中提取它。

#2


-1  

One solution I always use to prevent duplicate file references, is to create a solution folder such as "Project Dependencies". And then all refereces are made from that folder, so when building it pulls from the Project Dependencies folder.

我一直用来防止重复文件引用的一个解决方案是创建一个解决方案文件夹,例如“Project Dependencies”。然后所有引用都是从该文件夹中创建的,因此在构建它时会从Project Dependencies文件夹中获取。

This would work for resource files also, just copy them to the solution folder first and then drag them into your resource.

这也适用于资源文件,只需将它们首先复制到解决方案文件夹,然后将它们拖到资源中。

And for the assembly icon, just browse to the Project Dependencies folder as well.

对于程序集图标,也可以浏览到Project Dependencies文件夹。

Good Luck!

#1


2  

The way that the adding of an application icon is that you must select it from the local file system, and then it is embedded into the application at build time. As far as I know it is not possible to have it first pull from a resource file.

添加应用程序图标的方式是必须从本地文件系统中选择它,然后在构建时将其嵌入到应用程序中。据我所知,不可能首先从资源文件中提取它。

#2


-1  

One solution I always use to prevent duplicate file references, is to create a solution folder such as "Project Dependencies". And then all refereces are made from that folder, so when building it pulls from the Project Dependencies folder.

我一直用来防止重复文件引用的一个解决方案是创建一个解决方案文件夹,例如“Project Dependencies”。然后所有引用都是从该文件夹中创建的,因此在构建它时会从Project Dependencies文件夹中获取。

This would work for resource files also, just copy them to the solution folder first and then drag them into your resource.

这也适用于资源文件,只需将它们首先复制到解决方案文件夹,然后将它们拖到资源中。

And for the assembly icon, just browse to the Project Dependencies folder as well.

对于程序集图标,也可以浏览到Project Dependencies文件夹。

Good Luck!