Having trouble setting the icon in MSVC 2008 - winforms

I am making a C++/CLR Winforms application in MSVC 2008, but I can't seem to set the icon.
I have added a .ico file as a Resource (Add->Resource->Icon->Import) and added a line to the .rc file (and fully recompiled, but nothing has changed; it still uses the default icon.
There are no other icons added. I can see and edit the .ico with the in-built icon editor; it has both 16x16 and 32x32 sizes.
What else do I have to do?
[Edit] Just noticed that my icon is correctly showing in Windows Explorer, but not in the application when it runs.

Related

Remove icon from Win32 resources in Windows Forms

While making a Forms app, I added an icon file to the Icon field of the resources:
I now changed my mind, and want to use the default icon. Is there a way to clear that field? I tried deleting the file, and now it just won't compile. Restarting Visual Studio does nothing.
I know there's a way to get the default icon from the assembly files, but isn't there a way to simply reset that to its original state?

Unwanted general icon under specified file type icon after installing a WinForm app

I'm developing a WinForm app which needs to set the icon for file types specified in Setup project.
My OS is Win7 x64. Visual Studio 2017 Community and .Net Framework 4.6 are used. Icon has transparent pixels and is 128x128.
The problem is, after installation, icons are shown above another icon:
I just want files to have the exact icon I set:
Inkscape has the same problem.
Edit. I've already tested the following workarounds:
Resize the icon to 256x256.
Delete IconCache.db from AppData\Local folder and restart explorer.exe, which is recommended for broken-icons situation (all or some of files and shortcuts have a general icon).

Making icon for a Windows Form: How to make it show up correctly?

OK, so I have built a Windows Form application. I now want an icon for it. So I use the Icon Editor built into Visual Studio 2012. Draw it all out to look nice and purdy. Once I am done, I have a .ico file and I make it the default icon for the project, and also the icon for the one WinForm in the application.
Unfortunately, it does not show up as I have created it! It is displayed as the default icon file as it existed before I modified it in the icon editor. It's a 32x32 4 bit icon. If I change the extension to .bmp it shows up as the default.
It looks like the VS icon editor is editing something else, not the appearance of the icon. Can someone tell me what I am doing wrong?
I used to have a progam called IconArt that would create icons that looked like icons when I used them in VS. IconArt is now abandonware and won't run on my 64bit Windows workstation.
Since I didn't get any answers within the time I was hoping, I posted this question also in the MSDN Visual Studio forum, and got a good answer that I thought I should post here. Credit to Reed Copsey, Jr, for the answer!
This is it:
You'll need to put your design in all of the different versions. ICO
files contain multiple versions of the same image, for different
screen resolutions.
My personal preference is to not use VS - there's an ICO plugin for
Paint.Net (all free) which allows you to make a single image
(typically 256x256), and save multiple versions within an ICO file in
one shot. It's very useful for building icons.
See
http://forums.getpaint.net/index.php?/topic/927-icon-cursor-and-animated-cursor-format-v37-may-2010/
for the plugin.
Since I am a Paint.Net user, the plugin sounded like a great idea, and I tried it. Bingo! This works very nicely.

What is wrong with my current WPF project that I can't import FXG files? Expression Blend

I'm working on a WPF project, in Blend, and wanted to import an Adobe FXG file, but that command is disabled. The other commands under File>Import are enabled.
Also, I created a new blank WPF project and the command is enabled, I can import the file normally (it gives me the symbols to select etc. and brings them into the project as usercontrols).
I also tried a workaround by just adding the file to the project, it shows up in the list but the symbols are not usercontrols.
Ok, I restarted Blend, nothing changed. I restarted my laptop, and now it's enabled. Very odd.

WPF application shows "Image format is unrecognized "

I have a WPF application which runs fine on Windows 7 OS. But the same app crashes on a particular few Windows XP machines.
It runs fine on few windows XP machine. but on a few XP machine it fails to start.
ERROR - Image format is unrecognized.
I know this question has been asked few times. but my problem is i am still not able to figure out as to how to resolve this.
Should I change the .ico used for the application ..
Unfortunately, simply removing the 256x256 application isn't the greatest solution when you want to support the large icon size for Windows Vista, 7, 8 and forward.
Another way to solve this problem ... is to not compress the 256x256 image in the icon. See this forum thread for more info.
How does one do that? Well, most icon utilities will have an option for this (as this is a common problem). I use IcoFX and below you can see the option (highlighted in red) I needed to clear.
I've had a bit of fun with this problem this morning. It turned out that the error was occurring only on XP machines where the colour settings were set to 16 bit, and when I changed it to 32-bit the problem magically disappeared.
This goes for XP (including Embedded) SP3.
In your WPF application you will have at least two places to set icons:
The application icon. This is used for displaying the application in Explorer, desktop, etc. You set this in the project properties.
The window icon. This is used as icon in the upper-left corner of the window, and perhaps for alt-tabbing and on the taskbar. You set this as the Icon property on the window.
Often, you may use the same icon file in both cases. However, if you have a compressed 256x256 icon as window icon, then this can crash in Windows XP. This is what you are experiencing. On the other hand, this not the case when the application icon has a compressed 256x256 icon.
So another solution (which I implemented in all my projects) is to have two icons: The application icon (which contains all sizes) and a special "window icon" version, which only contains the sizes 16x16 and 32x32 (since those are the only sizes which are used).
If I remember correctly Windows XP does not support icons larger than 48x48 pixels and this could be the reason for the crash. .ico files should definitely run on both systems.
You can create an icon that support multiple sizes, so if you add 48x48 and for example 256x256 in the same file you should be good. Also be sure to use select a good software to produce the icon when making icons that support multiple sized. I've used Greenfish Icon Editor which I think works fine. But there are multitudes of other products for this.
Be sure to read The ICON handbook, section Windows, it contains good info about what icon sizes and bit depths to use.
Other threads on SO supports my belief:
problems with icon image
Which icon sizes should my Windows application's icon include?
Another workaround to (16/32bit resolution problem) is not to define icon in XAML, but load it in code:
this.Icon = new BitmapImage(new Uri("pack://application:,,,/UserInterface;component/Resources/Icons/ReportViewer.ico"));

Resources