[API Proposal] Ability to set the default icon for Forms.
See original GitHub issueIs your feature request related to a problem? Please describe
Currently the only way to set the default icon is via reflection. This is risky as it is looking at the internals of the object. It would be best to expose an API to set it.
Example of a way to set the icon currently:
typeof(Form).GetField("defaultIcon", BindingFlags.NonPublic | BindingFlags.Static).SetValue(null, SystemIcons.Shield);
Describe the solution you’d like and alternatives you’ve considered
namespace System.Windows.Forms;
public class Form
{
/// <summary>
/// Gets / sets the default icon used for a <see cref="System.Windows.Forms.Form"/>.
/// </summary>
/// <exception cref="System.ArgumentNullException">value is null.</exception>
public static System.Drawing.Icon DefaultIcon { get; set; }
}
Will this feature affect UI controls?
Designer should not have to change for this. It should not impact accessibility. It should not need to be localized.
Issue Analytics
- State:
- Created 6 months ago
- Comments:21 (17 by maintainers)
Top Results From Across the Web
c# - Change default icon
Go to form's properties, ICON ... Choose an icon you want. EDIT: try this. Edit App.Ico to make it look like you want....
Read more >Proposed File Browser Icon Feature
I've never been a fan of seeing a unique icon for each distinct file type in a code editor's file browser; it feels...
Read more >Default Icon + Conditional Icons according to a response
Hi, I have a Microsoft Forms linked to a Sharepoint List (below) with a conditional formatting ("Resultado Geral" column) and linked this.
Read more >Web Application Manifest
The manifest's icons member are images that serve as iconic representations of the web application in various contexts. For example, they can be ......
Read more >App manifest overview
By default, this icon is inherited from whichever icon is declared for the parent component, either the <activity> or <application> element. You might...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’m not sure I fully understand the business need behind this request. A form’s icon can be set via the
Icon
property. TheDefaultIcon
is an implementation detail that ensures there’s a default icon set. I would also struggle to buy in to a “we have tens/hundreds of forms in which we need to set Icon property over and over” situation - as it would denote architectural issues with the application.I didn’t consider the fact that there are multiple sizes needed for
Form
. (WM_SETICON
)There is a presumption that
Icon
is going to have all of the size data in it. You’ll get undesirable results when extracting a givenHICON
to createIcon
.I’m not sure the best way to handle this. Going to sit on this for a bit while I think about various options.