Windows Forms Application Icon

I've been developing a windows forms application for a while now and today I decided to add an icon to it.

I went to the Application tab of the project's properties window and set the icon. I could see the new icon for the .exe file but when I started the application the icon on the task bar was the standard icon.

After googling around for a bit I found out that I had to set the icon for all the forms in the project.

I added a resource for the icon file on the resources tab of the properties window and then used the following code in the Form_Load funtion to set the icon:

 System.Drawing.Icon ico = Properties.Resources.icon;
 this.Icon = ico;

You'll have to change the "icon" to the name of the resource you've added.

Popular posts from this blog

Domain Controller Machine Password Reset

Configuring a Certificate on Exchange Receive Connector

Running Multiple NGINX Ingress Controllers in AKS