Determine screen color depth / monochrome in .NET compact framework 2.0?

I use .NET CF 2.0 on several devices that have different display capabilities (especially color / monochrome) that I would like to detect at runtime but cannot find any methods that provide access to this information.

+4
source share
2 answers

P / Invoke GetDeviceCaps with COLORRES for nIndex value.

Change 1

This gives you color depth, but not the actual "color" and "monochrome." It is not really provided anywhere, because it is not important at this level.

As a rule, you can look at the color depth and say that if it is 8-bit or less, it will very, very likely be gray. Most likely, the color will be color.

Of course, OEM could use the 16bpp driver on a monochrome display. There is no reason why you cannot do this, it is simply inefficiently wasteful, because monochrome equipment does not have any wires or counterweights for extra bits, so they are simply dumped onto the floor.

If you really need to know if it is really color or monochrome, the only reliable way to find out if it really asks the user through the setting.

+3
source

To get this information, you need P / Invoke GetDC () and GetDeviceCaps (). Here is your link:

http://blogs.msdn.com/davidklinems/archive/2005/02/02/366042.aspx

+2
source

Source: https://habr.com/ru/post/1299153/


All Articles