Changing the icon of an executable file
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.
Supported Visual Studio Versions
Check Visual Studio Version
Windows Forms applications (C#, VB.NET)
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)
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)
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++)
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++)
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.
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: