更改 F# 应用程序图标 [英] Changing F# application icon
问题描述
我正在使用 Visual Studio 2013 和 F#
开发 Windows 应用程序,但我无法更改默认应用程序图标.
I'm developing Windows Application using Visual Studio 2013 and F#
but I can't change default application icon.
我尝试为 font-end 创建一个 C#-WPF 应用程序,它工作正常.但我不想用 C# 来做 font-end.
I have tried to create a C#-WPF application for font-end, it work. But I don't want to use C# for font-end.
我在构建应用程序后也尝试过资源黑客,但它不起作用.
I also tried resource hacker after building my application, but it is just not working.
推荐答案
应用程序图标是查看 EXE 文件时出现在 Windows 资源管理器中的图像.设置 F# Windows 应用程序的应用程序图标:
The application icon is the image that appears in Windows Explorer when viewing the EXE file. To set the application icon of an F# Windows Application:
创建一个扩展名为 *.rc 的文本文件.
Create a text file with an *.rc extension.
在 *.rc 文件中添加一行(当然可以替换您的图标文件的名称):1 ICON "icon.ico"
.
Add one line to the *.rc file (substituting the name of your icon file, of course): 1 ICON "icon.ico"
.
将带有 rc.exe 的 *.rc 文件编译成 *.res 文件.
Compile the *.rc file with rc.exe into an *.res file.
在 Visual Studio 中,在 *.exe 项目的属性页中,将 *.res 文件设置为项目的资源文件".
In Visual Studio, in the property page for your *.exe project, set the *.res file as your project's "Resource file."
当我们讨论这个主题时,出现在 Windows 任务栏中的图标来自主窗口图标.可以这样设置:
While we are on the topic, the icon that appears in the Windows task bar comes from the main window icon. It can be set like this:
- 将图标作为资源(而不是 EmbeddedResource)包含在项目中.
- 在主窗口 XAML 中,使用程序集路径引用图标.
示例:
<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Icon="/MyAssemblyName;component/MyPathToIcons/Logo.ico">
这篇关于更改 F# 应用程序图标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!