Sunday, August 29, 2010

Determine Color Depth

In C# we can read-out the color depth. This is set for every monitor, so first the desired screen has to be selected. For example Screen.PrimaryScreen denotes the primary screen, with Screen.AllScreens[Nr] Monitor [Nr] can be chosen.
The color depth is saved in the property BitsPerPixel, as the color depth says, by how many bits per pixel the color is described. There is 16 and 32 bit, nowaways nearly all computers use 32 bit:
The following command detects the color size of the primary screen:

int ColorDepth = Screen.PrimaryScreen.BitsPerPixel;

No comments:

Post a Comment