(HBRUSH)(COLOR_WINDOW+1)等同GetSysColorBrush(COLOR_WINDOW)

来源:互联网 发布:linux设置目录权限 编辑:程序博客网 时间:2024/05/23 07:22

      Windows requires that you add 1 when you use these identifiers and are specifying them in the hbrBackground field of the WNDCLASS structure, but doing so has no profound purpose other than to prevent the value from being NULL.

--摘自《window程序设计》
意思是说,使用颜色的时候,必须把每个颜色宏+1,才能得到正确的颜色,这是用法,没有特别的含义。
因为滚动条颜色宏被定义成 #define COLOR_SCROLLBAR 0
如果不进行+1的话,使用这个颜色就是意外的变成NULL,为了避免这种情况,所以把所有的颜色值+1处理。

 

其他里面具体怎么实现的,我还真不知道,微软说的:要+1。

原创粉丝点击