SetClassLong不能立即设置效果 需要重绘。

在单文档的 VIEW类里

SetClassLong(GetSafeHwnd(),GCL_HBRBACKGROUND,(LONG)GetStockObject(2));

改变背景是可以的 能够立即看出来

但是要是对话框里的oncreate里需要重绘

InvalidateRect(NULL,TRUE);

这样才会看出效果

 

From   MSDN:
Use   the   SetClassLong   function   with   care.   For   example,   it   is   possible   to   change   the   background   color   for   a   class   by   using   SetClassLong,   but   this   change   does   not   immediately   repaint   all   windows   belonging   to   the   class

 

/*#define WHITE_BRUSH         0
#define LTGRAY_BRUSH        1
#define GRAY_BRUSH          2
#define DKGRAY_BRUSH        3
#define BLACK_BRUSH         4
#define NULL_BRUSH          5
#define HOLLOW_BRUSH        NULL_BRUSH*/

你可能感兴趣的:(null,class,function,windows,文档)