:beetle: bugarea-System.Drawingarea-Theminghelp wanted
Repository metrics
- Stars
- (4,100 stars)
- PR merge metrics
- (平均マージ 14d 22h) (30d で 56 merged PRs)
説明
.NET version
6.0
Did it work in .NET Framework?
No
Did it work in any of the earlier releases of .NET Core or .NET 5+?
No response
Issue description
There is a long-known issue that NotifyIcon does not use the proper icon size. Rather than using the small icon size, it takes whatever size the System.Drawing.Icon has been constructed for (usually the default icon size), which Windows then scales down to the small icon size.
There is a work-around:
_notifyIcon.Icon = new Icon(_notifyIcon.Icon, SystemInformation.SmallIconSize);
NotifyIcon should do this itself.
Steps to reproduce
- Create a new WinForms project, name it "NotifyIconBug".
- Add a resource file and name it
Resource1.resx. - Add an icon with sizes of 16x16 and 32x32 to the
Resource1.resxand name itapplication_icon. Use images for the two sizes of the icon that are distinguishable from one another. - Add a
NotifyIcontoForm1and name itnotifyIcon1. - Set the
Iconproperty of theNotifyIconto the icon:notifyIcon1.Icon = Resource1.application_icon; - Run the project, having the notification area on a low-DPI display. The 32x32 size of the icon is displayed scaled down to 16x16 rather than displaying the 16x16 size.
I'd guess you could also recreate this on a high-DPI display as well if you scale up the above sizes accordingly.