更改F#应用程序图标 [英] Changing F# application icon

查看:121
本文介绍了更改F#应用程序图标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用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:


  1. 创建扩展名为* .rc的文本文件。

  1. Create a text file with an *.rc extension.

在* .rc文件中添加一行(当然代替你的图标文件的名称): 1 ICONicon.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:


  1. 将项目中的图标作为资源(不是EmbeddedResource)包含在内。

  2. 在主窗口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屋!

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