1
Vote

Form Icon Incorrectly Scaled

description

When the source Icon does not provide an icon of size SystemInformation.SmallIconSize, the Form icon is not scaled correctly.

Details:
The CustomBorderForm.SmallIcon setter property uses the Icon class constructor to locate a version of SystemInformation.SmallIconSize, and later in OnNonClientAreaPaint it is assumed that such a size was found. If it was not found, the icon is still drawn using e.Graphics.DrawIconUnstretched(...) instead of e.Graphics.DrawIcon(...).

Fix:
In CustomBorderForm.OnNonClientAreaPaint, change the following line:
if (smallIcon != null)
...to:
if (smallIcon != null && smallIcon.Size == SystemInformation.SmallIconSize)

comments