可以通过以下的方法找出当前显示模式的色深:
GetDeviceCaps(Form1.Canvas.Handle, BITSPIXEL) *
GetDeviceCaps(Form1.Canvas.Handle, PLANES)
结果用位数表示。可能返回的值有:
1 = 2 colors bpp
4 = 16 colors bpp
8 = 256 colors bpp
15 = 32768 colors (will return 16 on most drivers) bpp
16 = 65535 colors bpp
24 = 16,777,216 colors bpp
32 = 16,777,216 colors (same as 24) bpp
可以使用:
NumberOfColors := (1 shl
(GetDeviceCaps(Form1.Canvas.Handle, BITSPIXEL) *
GetDeviceCaps(Form1.Canvas.Handle, PLANES));
用于计算颜色的总数。
转载于:https://www.cnblogs.com/myamanda/articles/1523950.html