WinForms app uses low-quality title bar icon on 16-bit display

1k views Asked by At

On displays with 16-bit color depth (including Remote Desktop sessions set to 16-bit color), Windows Forms applications use a low-color-depth version of the assigned title-bar icon (Form.Icon). WPF applications and Windows Explorer, however, use the 24-bit color depth, if it exists.

I first saw this in a Windows Forms application I'm currently working on. The icon I was using had 4-bit, 24-bit, and 32-bit variants defined. On 16-bit displays, Windows Forms was using the ugly 4-bit version in the title bar instead of the nice-looking 24- or 32-bit version.

To test and illustrate the behavior, I created a test icon with obviously different designs for each size and color format. I included 4-bit, 8-bit, 24-bit, and 32-bit variants.

Here are the results on both 32-bit and 16-bit displays:

On 32-bit displays, all is well:

Windows Explorer:

Windows Explorer, 32-bit display

WPF Application:

WPF Application, 32-bit display

Windows Forms Application:

Windows Forms Application, 32-bit display

On 16-bit displays, Windows Forms displays a lower-color-depth variant of the icon than does WPF or Windows Explorer:

Windows Explorer:

Windows Explorer, 16-bit display

WPF Application:

WPF Application, 16-bit display

Windows Forms Application:

Windows Forms Application, 16-bit display

On 16-bit displays, Windows Explorer and WPF use the 24-bit format, but Windows Forms does not. In this case, it used the 8-bit format. My real application icon did not have an 8-bit variant (but I'm going to make one now!), so Windows Forms used the 4-bit variant.

How can I make my Windows Forms application display the 24-bit version of an icon in its title bar on a 16-bit display?

1

There are 1 answers

0
BVdjV On

Unfortunately, there is no way in which you can display a 24 bit image on 16 bit systems. However, you could come up with a trick that adapts you application to the system it's running on.

So, you could try to fake the "bit" field of the picture (try using some photo editing software) into thinking it's a 16 bit when it's actually 24. That's possible, I have managed to do it some years ago, but I cannot remember how (sorry).

I guess this is the way you should try solving your problem.

Good luck!