I am working on a first time C# project in Visual Studio 2005 and I am wondering if there is anything special that needs doing to change the application icon apart from changing the correct resource in the project properties.
I manage to view the new icon displayed in Explorer, but the icon in the application, the tray, and the task bar stays as the old icon.
I am wondering if this has anything to do with Windows Vista perhaps caching the applications icon and from then on not really refreshing it. The same happens in Explorer if you have thumbnails turned on.
If it does indeed cache the icon, what can I do to update/delete the cache, and also what is it based on (GUID perhaps? Not file name though as I changed that and still the same).
Thanks
Have you tried setting a Form.Icon (Winforms) or Window.Icon (WPF)?
It has probably nothing to do with Vista. Following shots shows a Windows Form Apploication runnig on Vista. You may have tried same template but using .Net Framwork 2.0.
I am not sure but i think .Net Framework 3.0 was not available with VS 2005.
You need to set the Forms Icon property.
Additional tray icon from resources. Put an appropriate image into the resources and name it icon.
NotifyIcon tray = new NotifyIcon();
tray.Icon = Icon.FromHandle(WindowsApplication1.Properties.Resources.icon.GetHicon());
tray.Visible = true;
I had the exact same problem when I wanted to create an icon for my WinForms program.
The following solution worked for me:
Start creating an icon in i.e. Paint or Photoshop. Make the size preferably 256x256 and 24 bit color. If you use 32 bit color, you won't be able to make the background transparent.
Save your image as .png.
Use your favourite internet browser and enter the page http://iconverticons.com/online/
This page converts your .png into an .ico-file. Since you had an 256x256 input file, the web application is able to create an .ico-file with sizes from 256, 128, 64, 32, 24 and 16 squared.
This icon can then be added to your project by right-clicking your projects name in solution explorer -> Properties -> Application. Under the Resources-field, choose Icon and manifest, and press the three dotted button to the right for the icon-combo box. Browse to your icon-file and choose it.
This will add the icon to your project as you can see when using windows explorer. Note that you have to copy the .exe file from your bin-directory into another directory in order to see the change of icons. This is because the thumbnail icons are not refreshed so easily.
This will, however, not add the icon to your task bar. In order to do that, go to your Form design window, that is where you can change the graphical appearance of your program. Go to properties and choose "Form1" in the combo box. There you will find an option called Icon. By browsing this property to your .ico-file, you can add the icon file to your program and it will appear on the task bar as well.
I hope this works for all of you who wants to add an icon to your project. I will add some descriptive images once I get enough rep.points to enable that :-|
The Icon in tray, and the task bar is based on the Form or Window Icon. The application Icon (the one you see in explorer) is set in the properties.
I've just suffered from the same problem, 8 years on.
It does appear that Windows (7) or Visual Studio (2017) is caching the icon.
The only way I can find to clear this cache is with a power cycle.