Reputation: 41
I've written a program in Visual C# 2010 on Windows7, and I want to change the icon it displays in the start menu and taskbar.
I've changed the icon to what I want in three different places: on the main form's properties list in the form designer; in the NotifyIcon that I added to the project; and in the project's properties page in the "icon and manifest" entry of the Application section.
The result is that I have the correct icon on the app's title bar, and in the system tray, and in the array of icons for running apps that comes up when you hit alt-tab. But I still have the wrong icon in the start menu (I just dragged the executable to the start menu to put it there), and in the taskbar. What's weird is when I hover the mouse over the (wrong) icon in the taskbar, the correct icon pops up underneath it, along with the app's title.
Can someone tell me what else I need to change to make ALL the icons displayed be the one I want?
Related question: also in the start menu, the name shows up as the default "WindowsFormsApplication1," even though I've also changed that everywhere I can think of, including all the project directories and namespaces. I can easily rename it in the start menu, but I would like it to just be right when I drag it there.
Any help on either problem greatly appreciated.
Edit: on my screen at least, my answers to the comments are hidden, so I'll add them here:
1) I'm not really deploying this yet, I'm just running it, either from the VC# IDE, or by clicking on the exe file that VC# creates.
2) I didn't add the app to the taskbar. I am talking about the icon that just appears in the taskbar when the app is running.
3) I did not see anything about sizes in any of the three places I mentioned where I changed the icons.
4) How do I update the icon in the exe?
5) the problem persists even if I completely shut down and restart the PC.
Thanks to all who responded.
Edit 2: also forgot to add that the correct icon appears next to the filename in Windows Explorer.
Upvotes: 4
Views: 3060
Reputation: 359
You'll need to change the shortcut's icon to your app. Start menu and taskbar both use the shortcut's icon.
Alternatively, you could also use WM_SETICON to set an icon which will override the shortcut icon.
Upvotes: 0
Reputation: 13033
Just posting this comment from Hans Passat as an answer for greater visibility here.
The windows shell caches the icons that are used on the taskbar, so even after making a change to your .NET project and redeploying the application, you might still see the old (or default) icon on the taskbar. The solution is to navigate to the folder C:\Users\usernamehere\AppData\Local and rename the file IconCache.db to something else, such as IconCache.old.db.
Then logout and login again.
This should fix the issue and you will now see the new icons in the taskbar.
Upvotes: 2
Reputation: 41
Taking the most radical approach, I started a brand new project, copied all the cs files from the old project, and set all the icons to the one I wanted before doing a build. That worked; all the icons are right, and the name in the start menu is right.
But surely there is a way to change them after the initial build???
Upvotes: 0
Reputation: 8696
The icons in the taskbar (if its pinned) and start menu are part of the shortcut that gets created when initially set. You'll have to delete and recreate them. They don't reflect changes to the apps icon dynamically.
Upvotes: 0