dotnet / dotnet/winforms

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

Open
#8,905 21 comments 0 reactions 1 assignee Claimed by @JeremyKuhne View on GitHub
api-approved area-System.Drawing
Dominant language
C#
Stars
4.9k
Forks
1.1k
Avg merge
1d 13m
Merged PRs (30d)
85

Description

### 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:

``` C#
typeof(Form).GetField("defaultIcon", BindingFlags.NonPublic | BindingFlags.Static).SetValue(null, SystemIcons.Shield);
```

### Describe the solution you'd like and alternatives you've considered

``` C#
namespace System.Windows.Forms;

public class Form
{
///
/// Gets / sets the default icon used for a .
///
/// value is null.
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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.