views:

136

answers:

2

I'm using the .NET CF 2.0 on multiple devices which have different display capabilities (specifically color/monochrome) that I'd like to determine at run-time but can't find any methods that provide access to this information.

+1  A: 

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

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

MusiGenesis
+1  A: 

P/Invoke GetDeviceCaps with COLORRES for the nIndex value.

Edit 1

This gives you color depth, but not actual "color" versus "monochrome". That one is actually not provided anywhere because it's not actually important at that level.

Generally you can look at color depth and say that if it's 8-bit or less, its very, very likely to be greyscale. Greater is likely to be color.

Of course the OEM could have used a 16bpp driver on a monochrome display. There's no reason you can't do it, it's just really inefficient wasteful becasue the monochrome hardware doesn't have any wires or provisions for the extra bits, so they just get dumped on the floor.

If you need to really, really know if it's color or monochrome, the only reliable way to know is to actually ask the user via a setting.

ctacke
This will get me the bits per pixel but doesn't tell me if it's monochrome or not.
ZippyBurger
That's what I was afraid of. Thanks for the info.
ZippyBurger