Changing the icon of an executable file

Page update date :
Page creation date :

summary

The icon of the executable file of the application created in Visual Studio has a default icon, but of course there are few people who will say that the icon as it is fine. This section describes how to change the icon of an executable file.

As described in Visual Studio 2008 Standard Edition, I don't think there is any difference in the basic parts in other versions of Visual Studio.

デフォルトの実行アイコン (アプリケーションの種類によって若干異なります)

Operating Environment

Supported Visual Studio Versions

  • 2005
  • 2008
  • 2010

Check Visual Studio Version

  • 2005
  • 2008
  • 2010

substance

Windows Forms applications (C#, VB.NET)

Windows フォーム アプリケーション

Describes how to change the executable file icon when you create a Windows Forms application that uses the .NET Framework. There is little difference between programming languages. (Except C++/CLI)

プロジェクトのプロパティ

After opening the project, open Properties from the Solution Explorer.

実行ファイルのアイコン変更ボタン

When the properties screen opens, click the red circle button in the figure on the right. Here you can change the icon of the executable.

アイコン選択

Select the icon when the file chooser dialog opens.

アイコンが変更されている

Then, the icon becomes the one that was loaded, and the icon name is changed.

アイコンがプロジェクトに追加される

You can see that the icon has also been added to the project.

実行ファイルのアイコン

When you build the project, you can see that the icon of the executable has changed.

フォームのアイコン

The icon that appears in the upper-left corner of the form, but is not associated with the icon of the executable.

To change this, open the Form Designer screen, select the form to display its properties, and change it with the "Icon" property shown on the right. Note, however, that icons larger than 256px cannot be used.

WPF Applications (C#, VB.NET)

WPF の実行ファイルアイコン

You change the executable file icon in a WPF application in the same way that you change it in Windows Forms. Please check there for details.

プロジェクトにアイコンを追加

Before you can change the icon in the upper left of the window, add an icon or image file to your project.

アイコンを設定

Next, open the WPF Designer and set the icon file name directly to "Icon" in the Window properties.

Win32 applications (C, C++),  Windows Forms applications (C++/CLI)

Win32 アプリケーション

Provides information about setting the executable file icon for Win32 applications.

Also, for Windows Forms applications, C++/CLI is the way to do this.

アイコンファイル

When you open a project, there is an icon file called Resource File that is the same as the name of the project. This is the icon file that applies to the executable. (The name of the icon may be different depending on the type of project created, but ".ico" files are eligible)

アイコンエディタ

Try double-clicking the icon file to open it, and the icon editor will open for you to edit.

However, icons created by default are in 32-bit format, and for some reason they cannot be edited in the icon editor. Therefore, I think it is preferable to create a separate icon file and replace it with an existing icon file.

既存のアイコンファイル

The folder where you created the project has an icon file with the same name as the project. Replace this.

アイコンファイルを上書き

Overwrite the existing icon with the icon prepared in advance.

アイコンが変更される

You can see that the icon has changed in Visual Studio.

実行ファイルアイコンが変更されている

If you actually do the build and create the executable, you'll see that the icon has changed.

ウインドウのアイコン

By the way, the icon at the top left of the window is defined as a "small .ico" file, so if you want to change it, please rewrite this file.

Win32 Application Empty Project (C, C++)

Win32 アプリケーション 空のプロジェクト

Describes the settings for the Run icon file when you create an empty project in a Win32 application. It is a method that can be substituted by console applications.

作成されたプロジェクト

When you create an empty project, the project is created with the structure shown in the figure on the right. A folder is created, but no files are created.

リソースの追加

Right-click the Resource Files folder, click Add→ and then click Resources.

リソースの追加ダイアログ

When the Add Resource dialog box is displayed, select "Icon" and click the "New" button.

追加されたアイコン

The icon will be created and displayed on the screen. This icon automatically becomes the executable file icon.

プロジェクトにアイコンが追加されている

You can see that the icon file has also been added to the project.

実行ファイルのアイコンとして使用されている

If it is an empty project, you can not build it as it is, so if you create a console application instead, add an icon using the above method and build it, you will see that the icon is applied to the executable as shown in the figure on the right.

How to edit icons is the same as in Win32 applications, so please check there.

By the way, if you want to create a window from an empty project and set the window icon, you need to create a separate icon file (if it is different from the executable file) and set it in the program, but I will omit it because the explanation will be long. Try creating a Win32 application that displays the window and looking at the programs and resource files.

MFC Applications (C++)

MFC アプリケーション

Describes how to change the executable file icon for an MFC application. However, the method of changing the icon is almost the same as in a Win32 application, so please refer to it.

Whether it's MDI, SDI, or dialog-based, the modifier is the same.

MFC のデフォルトアイコン

The default icon is for MFC. This icon is created in 24-bit, so you can edit it directly in Visual Studio.

In addition, this icon file is shared by both the executable file and the window icon.

ドキュメントのアイコン

If you create it as a non-dialog-based application such as MDI or SDI, there is also an icon for the document. This is used as an icon for windows created on a per-document basis.

ウインドウのアイコン

The figure on the right shows the icon of the window created in MDI base.

Tools for creating icon files

To create an icon file, you need tools to create "image files" and "icon files". Or there are tools that combine both.

Any tool to create image files can be anything. 「. png" is preferable to a tool that can output files. You can also create it with Paint, which comes standard with Windows. There are the following free tools for creating image files.

From an image file to an icon file". The tools to convert ICO" files include the following: