myamanda

博客园 首页 新随笔 联系 订阅 管理
可以通过以下的方法找出当前显示模式的色深:

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));
    用于计算颜色的总数。
posted on 2009-07-15 11:20  myamanda  阅读(210)  评论(0编辑  收藏  举报