Asked by:
Why can't any ICON I create with the Icon Designer get displayed for my form's icon?

Question
-
WHAT I HAVE:
Visual Basic 2019, .NET 4.6.1, WinForms
MY PROBLEM:
I am writing a VB2019 project, and am trying to design my own icons using the icon designer (Project > Add New Item, then General > Icon File in the Add New Item Dialog) for display as forms' "corner" icons (that is, to the left of the form's caption). The problem is, no matter how I try to design an icon, and no matter what "image type" or set of types I use for any one of them, they don't get displayed properly. Whenever I try to add my icon as a resource--or make it the icon of a form directly--it either tells me it's in invalid format or it displays only a "generic image" (it looks like a page with a folded corner). What am I doing wrong?! What image type(s) should I define in order to get it to display in the resource editor, in the form designer, and/or at run-time as it appears in the designer?
Unfortunately, the help--either offline or online from Microsoft--doesn't say much on how to design a brand-new icon in such a way as to get it to properly display on a VB form and elsewhere in my VB project. (Indeed, a lot of the documentation isn't very friendly to those who are new to a particular thing--be it designing custom icons or whatever. I kinda assumes programmers are intimately experienced with any functionality that's been around for a while.) I need an answer fast.
Robert Gustafson
- Edited by RobertGustafson Sunday, August 9, 2020 9:16 PM
Sunday, August 9, 2020 9:03 PM
All replies
-
Hi RobertGustafson,
I made a test in the Visual Basic 2019 and the framework is .NET 4.6.1.
It can display icons normally and following is my steps.
1.Right click the project-> Add-> New Item-> General > Icon File.
2.Right click the form-> Properties-> Icon->Browse to your project file and select the icon file.
Since I can't reproduce the situation, Could you provide more information to reproduce it?
And I suggest you update your Visual Studio, recreate the project and try it.
Best Regards,
Daniel Zhang"Windows Forms General" forum will be migrating to a new home on Microsoft Q&A (Preview)!
We invite you to post new questions in the "Windows Forms General" forum’s new home on Microsoft Q&A (Preview)!
For more information, please refer to the sticky post.Monday, August 10, 2020 5:23 AM -
Hello,
I tried this and had zero issues. Best thought is to report this to Microsoft via the feedback link in the editor's title bar.
Please remember to mark the replies as answers if they help and unmarked them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.
NuGet BaseConnectionLibrary for database connections.
Tuesday, August 11, 2020 11:14 AM -
I'm not trying to load an icon file; I'm trying to create one. And whenever I try to create one, then load it into a form or as a resource, it won't display except as a generic "folded-paper" image either in the designers or at run-time.
I've tried creating images under various size/color-range formats for the files, sometimes even with images in multiple formats to the same file. I either get a format error or just the stock image upon loading or displaying it.
Robert Gustafson
- Edited by RobertGustafson Wednesday, August 12, 2020 12:56 AM
Wednesday, August 12, 2020 12:53 AM -
Hi RobertGustafson,
Based on your description, I can't reproduce the situation. How did you create the icon file?
According to your description, the icon you created can't be used effectively
And the argument picture need to be a picture that can be used as an icon.
About icon requirements, you can refer to this document.
You can also try the iKishanSojitra's answer that converting picture to icon with all sizes available.
Hope it could be helpful to you.
Best Regards,
Daniel Zhang
"Windows Forms General" forum will be migrating to a new home on Microsoft Q&A (Preview)!
We invite you to post new questions in the "Windows Forms General" forum’s new home on Microsoft Q&A (Preview)!
For more information, please refer to the sticky post.- Edited by Daniel_Zhang-MSFTMicrosoft contingent staff Thursday, August 13, 2020 7:37 AM
Wednesday, August 12, 2020 9:51 AM -
I would create an image using an app like Paint. Then I would size it to the proper icon size, and copy and paste it into the Icon Designer for a particular icon format (size and color range). The image style isn't necessarily "icon" in Paint to begin with. I try to hedge my bets by pasting versions of the image in for multiple formats in the same icon file, although I get these problems even when I paste it in for just 1 format. I also get the same problem when I design an icon from scratch in the designer (no pasting from elsewhere). I didn't have any of these problems with VB 2015, curiously enough. I don't know what I'm doing wrong in VB 2019! Is there a special, "preferred" format, or set of formats, for form and resource icons? (The designer lets you create and edit an image for any format except 32-bit. I've also learned how to convert bitmaps to icons at run-time, although that won't help me when defining an icon for the "installed" app for Explorer, or for "associated" files. I still need to be able to create icons for assignment at design-time!)
PS. Do I need define a "transparent color" at the Paint end? (That wouldn't explain why I can't create a displayable icon from scratch in the designer alone, though.)
PS. If I have to "move" this question thread (to "Microsoft Q & A") before the month ends, how do I do that?
Robert Gustafson
- Edited by RobertGustafson Thursday, August 13, 2020 4:17 AM
Thursday, August 13, 2020 4:05 AM -
Hi RobertGustafson,
Thank you for the detailed description and I suggest you report a problem on the Developer Community and you can get more professional answer.
Besides, you can post your new questions about winforms in the "Windows Forms General" forum’s new home on Microsoft Q&A.
Thank you for your understanding.
Best Regards,
Daniel Zhang
"Windows Forms General" forum will be migrating to a new home on Microsoft Q&A (Preview)!
We invite you to post new questions in the "Windows Forms General" forum’s new home on Microsoft Q&A (Preview)!
For more information, please refer to the sticky post.- Edited by Daniel_Zhang-MSFTMicrosoft contingent staff Thursday, August 13, 2020 9:26 AM
Thursday, August 13, 2020 9:26 AM