如何分配将在任务栏中显示的应用程序图标?

发布于 2024-09-04 08:31:08 字数 381 浏览 4 评论 0原文

我正在开发 Wpf 桌面应用程序,每当我运行我的应用程序时,它都会在任务栏中显示一个窗口和关联的选项卡(普通窗口功能)。我的问题是该选项卡使用窗口的图标来表示未知的文件类型,我尝试使用窗口的 Icon 属性,图标被分配,但问题仍然是当我运行应用程序时,任务栏选项卡最初显示未知文件类型的窗口图标以及何时窗口加载完成后,它会更改为指定的图标。我从一开始就想要 Icon。有什么帮助吗?

编辑:

我尝试使用 .csproj -->属性-->应用程序选项卡 -->图标 并将其设置为 .ico 文件。它有效,但我需要通过 .exe 文件运行我的应用程序。它在开发环境中不起作用(通过 Visual Studio 运行时)。然后我需要设置 Start-Project 选项。还有其他方法可以解决这个问题吗?

I am working on a Wpf desktop application, whenever i run my application it shows me a window and associated tab in the task bar(Normal windows feature). My problem is that the tab is using window's icon for unknown file-type, I tried with Icon property of Window, Icon gets assigned but still problem is when I run application, task bar Tab initially displays window's icon for unknown file-type and when window-load completes it changes to the Icon assigned. I want Icon there from beginning. Any help?

Edit:

I tried with .csproj --> Properties --> Application Tab --> Icon
and set it to a .ico file. It works but I need to run my application by .exe file. It doesn't work in development environment(while running through visual studio). I need to set Start-Project option then. Is there any other way to solve this problem?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

一江春梦 2024-09-11 08:31:08

检查主 Window 项目的属性。您应该能够在那里设置图标。

在项目上设置图标

更新:
您的图标在调试模式下不显示是这样的问题吗?只要你把程序交付给客户时它能工作就可以了,不是吗?

旁注:不过你可以检查一些事情。也许您的图标未包含在您的项目中,或者在构建到“调试”文件夹时未将其复制?

更新2:
您还需要设置主窗体的图标以使其在调试中显示。如果您还设置了主窗体的图标,它将在调试/运行时显示在任务栏中。

Check the properties of your main Window project.. You should be able to set an icon there.

Setting an icon on your project

Update:
Is it such a problem that your icon does not show in debug mode? As long as it works when you deliver the program to your customer, its all alright, not?

On a side note: You could check some things though. Perhaps your icon is not included in your project, or it isnt copied when building to your Debug folder?

Update 2:
You also need to set the Main Form's Icon for it to show in Debug. If you also set the icon for the main form, it will display in the Taskbar during Debug / Runtime.

像你 2024-09-11 08:31:08

我遇到了类似的问题,谷歌引导我找到了这篇文章。我忘记了一件简单的事情,那就是我的主窗体的图标。如果您还设置了主窗体的图标,它将在调试/运行时显示在任务栏中。

I had a similar issue and google led me to this article. I forgot one simple thing, and that was my Main Form's Icon. If you also set the icon for the main form, it will display in the Taskbar during Debug / Runtime.

水波映月 2024-09-11 08:31:08

对于 WPF 应用程序,使用 XAML 中 Window 元素的属性

Icon="Images\Logo.ico"

以使窗口显示图标。

For WPF applications, use the attribute

Icon="Images\Logo.ico"

for the Window element in XAML to have the window show the icon.

海风掠过北极光 2024-09-11 08:31:08

我知道这很旧,但我发现如果我转到项目的属性并选中“调试”页面上的“启用本机代码调试”框,我可以在调试模式下在任务栏中显示图标

I know this is old, but I found that I could get the icon to show in the taskbar in Debug mode if I went to the project's properties and checked the "Enable native code debugging" box on the "Debug" page

随风而去 2024-09-11 08:31:08

这对我有用。在 VB 应用程序中,转到(UI 项目的)项目选项的“调试”屏幕,然后选择“启用非托管代码调试”。不确定是否有任何负面影响,但它确实在调试过程中显示了图标。谢谢。

That worked for me. In a VB application, go to Debug screen of Project options (of the UI project) and select Enable unmanaged code debugging. Not sure if there are any negative side effects, but it sure showed the icon during debug. Thanks.

甜心小果奶 2024-09-11 08:31:08

这是旧的,但您也可以更改安装项目中的快捷方式图标,这对我有用(当通过右键单击安装项目查看文件系统时)。

This is old but you can also change the shortcut icon in the setup projet, this is what worked for me (when viewing file system by right clicking the setup project).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文