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

来源:互联网 发布:java基本数据类型 编辑:程序博客网 时间:2024/05/04 09:08
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处理。