question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[API Proposal] Ability to set the default icon for Forms.

See original GitHub issue

Is 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:open
  • Created 6 months ago
  • Comments:21 (17 by maintainers)

github_iconTop GitHub Comments

3reactions
RussKiecommented, Mar 29, 2023

I’m not sure I fully understand the business need behind this request. A form’s icon can be set via the Icon property. The DefaultIcon 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.

1reaction
JeremyKuhnecommented, Apr 13, 2023

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 given HICON to create Icon.

I’m not sure the best way to handle this. Going to sit on this for a bit while I think about various options.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found