I changed my Application's icon for a new one, by going to: "Project/MyProject Properties/Icon and Manifiest", and load the new icon. Now, in my debug folder the icon of my .exe file appear with the new icon, which is ok, but when I execut开发者_运维技巧e the .exe, the application icon in the taskbar still showing the old one.
Please advice.
You have two place to change your icon.
First place
The first place is in the project.
- Right click on the project
- Select Property
- Go in Application Tabs
- Choose Icon and Manifest and select the icon you want
Second place
The second place is in the property of your Winform.
- Open the Form
- Click on the Form
- Press F4 or go in the property of the Form
- Go down in the property to find "Icon"
- Select the icon you want.
The reason you have a different icon in the taskbar than your application (.exe) icon is that the taskbar use the current form icon to display in the taskbar.
After encountering the same problem, I resolved it by doing the following:
Just stop your explorer.exe from task manager and rerun the explorer.exe again.
As a commenter mentioned, you should set in the properties of the *.ico file: Copy to Output Dir: Copy if newer.
This property is not absolutely required. I developed a winform application and tested it without icon. Then I created and added the icon. The icon showed when running with the VS debugger. I copied the bin/debug directory to another pc and there it ran with showing the icon.
But the icon did not show on the development machine when the app started by clicking the *.exe file.
Logout/login windows did not cure this.
Change the Copy To Output Dir property on the icon file to Copy If Newer, and rebuild the application, did help. Now I can start the app by clicking the *.exe and the icon shows nicely.
Conclusion:
It is not always required to build the app with the icon file copied to the output directory, but with this measure you will increase your chances.
Make sure that your *.ico file contains an icon of the proper size (like 16x16 for small task bars).
- Copy your new icon in Project Properties --> resources --> icons
In your
Main_Load
function add:this.Icon = Properties.Resources.newIcon;
Check this out for icon information and sizes it supports. Assuming this is just a simple error that you are getting check if your ico's are as per what is specified here http://msdn.microsoft.com/en-us/library/ms997636.aspx
I had the same problem and none of the above solved it.
In my case, I had defined the icon different for two different langages (default language english and german). You can see this if there appear two resources files: FormX.resx
and FormX.de.resx
With the accepted answer only default icon was changed. But when running the application on my pc the german icon was used.
So I had to change the icon for both resources. In Visual Studio you can change the current resource language by switching the language item (in the forms properties) from default to another language.
I had the same problem. The "first place" mentioned by Patrick is about the file icon, i.e. the .exe aspect. The "second place" is about the form (in the upper left corner). Restarting windows file explorer seemed to be a satisfactory solution too. But all this didn't work today. I didn't restart the computer, by the way. This is what really displayed the new icon in the task bar: I realized that there was an old shortcut of the .exe on the desktop. Deleting the shortcut did the job.
If nothing else works, try restarting the Windows Explorer process:
- Open task manager.
- Right click at Windows Explorer process
- Click restart
精彩评论