如何将图标添加到WPF应用程序桌面快捷方式? [英] How to add icon to WPF application desktop shortcut?

查看:1509
本文介绍了如何将图标添加到WPF应用程序桌面快捷方式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请注意我询问的是DESKTOP图标,而不是窗口图标。该图标显示在应用程序窗口中。这可以。但是当我运行安装程序来安装应用程序时,桌面快捷方式只有一个默认图标。如何将桌面图标与相同的应用程序图标相关联?
应用程序运行时,任务栏上的图标是正确的图标。我还将ico文件设置为Resource和Embedded Resources。两者都不起作用。
谢谢。

Please note that I am asking about the DESKTOP icon, not the window icon. The icon shows up on the app window. This is fine. But when I run setup to install the application, the desktop shortcut has only a default icon. How do I associate the desktop icon with the same application icon? When the application runs, the icon on the taskbar is the correct icon. I've also set the ico file as Resource and as Embedded Resources. Neither works. Thanks.

我做到了这一点:

 <Window x:Class="..." 
         xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
         **Icon="YourIcon.ico"**>

以及:

在我的visual studio 2010中:项目 - >'ApplicationName'属性 - >选项卡应用程序 - >图标和清单。在那里你指定了你的图标

In my visual studio 2010 : Project -> 'ApplicationName' Properties -> Tab Application -> Icon and Manifest. There you specify your icon

这个:

确认你有一个在您的项目文件(.csproj或.vbproj)中输入如下:

verify that you have an entry like this in your project file (the .csproj or .vbproj):

<PropertyGroup>  
<ApplicationIcon>Resources\MyAppIcon.ico</ApplicationIcon> ...
</PropertyGroup> ... <ItemGroup>   <Resource
Include="Resources\MyAppIcon.ico" /> ... </ItemGroup>


推荐答案

我假设您正在使用Visual Studio安装项目来创建安装程序。

I assume you are using the Visual Studio Setup Project to create your installer.

转到视图 - >编辑器 - >文件系统 - >用户桌面 - > [快捷方式] - >属性 - >图标

Go to View->Editor->File System->User's Desktop->[the shortcut]->Properties->Icon

您可以在此配置图标。我也总是确保将图标文件作为独立文件复制到安装文件夹中(虽然我认为这不是绝对必要的)。

There you can configure the icon. I also always make sure the icon file is copied into the installation folder as a stand-alone file (though I don't think that is strictly necessary).

这篇关于如何将图标添加到WPF应用程序桌面快捷方式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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