C# 如何在安装项目中更改 windows Applicatoin 的默认图标
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2041291/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to change windows Applicatoin's default icon in Setup Project
提问by Azhar
How to change the Windows Application's default icon with other one in C# desktop application. I am trying to change it in Setup Project but it is not. I want to show my own icon with Application's shortcut rather then windows default icon
如何将 Windows 应用程序的默认图标更改为 C# 桌面应用程序中的其他图标。我试图在安装项目中更改它,但事实并非如此。我想用应用程序的快捷方式显示我自己的图标,而不是 Windows 默认图标
采纳答案by Jeff Roe
It is truly odd that when you are creating a deployment (set up) project, and you create a shortcut to the "Primary output" (an .exe), the shortcut does not automatically get the .exe's icon. Instead it gets a generic document shortcut icon. Some of the answers here suggest adding an .ico file to the installer, but that certainly feels wrong. You can get the desired icon into the shortcut without adding an .ico file.
确实很奇怪,当您创建部署(设置)项目并创建“主要输出”(.exe)的快捷方式时,该快捷方式不会自动获取 .exe 的图标。相反,它获得了一个通用的文档快捷方式图标。这里的一些答案建议向安装程序添加一个 .ico 文件,但这肯定是错误的。您无需添加 .ico 文件即可将所需的图标放入快捷方式。
Assuming you have already given your program the desired icon,
假设您已经为您的程序提供了所需的图标,
- In the solution explorer, right click on the installation project and go to "View -> File System".
- in the File System window, find the shortuct whose icon you want to change (for example, under "Users's Programs Menu")
- go to the shortcut Properties (right-click and pick "Properties Window")
- go to Icon
- Browse...
- change "Files of type" to *.exe
- browse to and select your "primary output"
- OK, OK
- 在解决方案资源管理器中,右键单击安装项目并转到“查看 -> 文件系统”。
- 在“文件系统”窗口中,找到要更改其图标的快捷方式(例如,在“用户程序菜单”下)
- 转到快捷方式属性(右键单击并选择“属性窗口”)
- 转到图标
- 浏览...
- 将“文件类型”更改为 *.exe
- 浏览并选择您的“主要输出”
- 好的好的
And as serhio pointed out, a similar process can set the icon for the Control Panel's "Add or Remove Programs" list.
正如 serhio 所指出的,类似的过程可以为控制面板的“添加或删除程序”列表设置图标。
回答by rahul
You can change the icon of the application inside the Windows Application itself. And put that application in the setup project.
您可以在 Windows 应用程序本身内更改应用程序的图标。并将该应用程序放入安装项目中。
Right click the WinApp Projectand inside the Application sectionyou can choose and Iconwhich will be an ico file. Browse for the icon fileand selectit. Build the project and attach it to the setup project.
右键单击 WinApp 项目,在应用程序部分中,您可以选择图标,这将是一个 ico 文件。浏览图标文件并选择它。构建项目并将其附加到安装项目。
回答by neo
Right click on you windows application project, select properties. In the properties window, select the application tab. In the application tab, there is a radio button saying Icon and manifest. Select that and browse and select your custom icon for the application in the Icon drop down menu.
右键单击您的 Windows 应用程序项目,选择属性。在属性窗口中,选择应用程序选项卡。在应用程序选项卡中,有一个单选按钮,上面写着图标和清单。选择它并在图标下拉菜单中浏览并选择应用程序的自定义图标。
Thnks
谢谢
回答by Aseem Gautam
Right click on Primary Output of Your Project and Select Create Shortcut. Give it a name and then click on its properties and set the icon.
右键单击项目的主要输出并选择创建快捷方式。为其命名,然后单击其属性并设置图标。
In the setup project you cannot change the primary output's icons. You can create new shortcuts on the desktop etc and apply custom icons on those.
在安装项目中,您无法更改主输出的图标。您可以在桌面等上创建新的快捷方式并在这些快捷方式上应用自定义图标。
回答by serhio
You can also change the Icon in the Add & Remove Programs list.
您还可以更改“添加和删除程序”列表中的图标。
For this select the Setup1 project and select the property AddRemoveProgramsIcon.
为此,选择 Setup1 项目并选择属性 AddRemoveProgramsIcon。
You can select an .ico file or leave the main .exe output as file for the icon.
您可以选择 .ico 文件或将主 .exe 输出保留为图标文件。
回答by Elmer
Make sure you .ico is not to big. Had this issue for hours just to find 256x256 is to big. 48x48 is perfect but I think 128x128 might also work.
确保您的 .ico 不大。有几个小时的这个问题只是为了发现 256x256 太大了。48x48 是完美的,但我认为 128x128 也可以。