简体   繁体   English

如何在 TaskManager 中更改 C# WinForms exe 的图标

[英]How to change the icon of a C# WinForms exe, in TaskManager

I've already set the icon in the Project Properties, and the FormControl Icon.我已经在项目属性和 FormControl 图标中设置了图标。 I've thus got my icon ( .ico file) in:因此,我的图标( .ico文件)位于:

  • The TaskBar.任务栏。
  • The TaskTray.任务托盘。
  • The top-left of the Form.表格的左上角。
  • In Windows Explorer, if I navigate to the exe on disk.在 Windows 资源管理器中,如果我导航到磁盘上的 exe。

But I've still got the default icon in TaskManager:但我在 TaskManager 中仍然有默认图标:

在此处输入图片说明

How do I fix that, in my C# WinForm?如何在我的 C# WinForm 中解决这个问题? (ie make the icon in the red circle look unique, like VS, Excel, Firefox, etc. all do) (即让红圈中的图标看起来独一无二,像VS、Excel、Firefox等都可以)

(There are a few answers that appear to address this in C++, but nothing in C#-land, or WinForms.) (有一些答案似乎在 C++ 中解决了这个问题,但在 C#-land 或 WinForms 中没有。)

Dammit.该死的。 It turns out the answer is "close and re-open TaskManager".事实证明,答案是“关闭并重新打开 TaskManager”。 It must have cached the icon.它必须缓存了图标。

Restarting the exe didn't help, but restarting TaskManager sorted it.重新启动 exe 没有帮助,但重新启动 TaskManager 对其进行了排序。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM