VC中如何获取窗口当前的背景颜色,具体用到什么函数?
1个回答
展开全部
GetClassLong(hwnd,GCL_HBRBACKGROUND) 获得背景画刷
GetObject 根据背景画刷获取逻辑画刷
typedef struct tagLOGBRUSH {
UINT lbStyle;
COLORREF lbColor; //这里就是背景颜色
LONG lbHatch;
} LOGBRUSH,
或者用GetClassInfo 根据类名获取其WNDCLASS结构
typedef struct _WNDCLASS {
UINT style;
WNDPROC lpfnWndProc;
int cbClsExtra;
int cbWndExtra;
HINSTANCE hInstance;
HICON hIcon;
HCURSOR hCursor;
HBRUSH hbrBackground; //背景画刷
LPCTSTR lpszMenuName;
LPCTSTR lpszClassName;
} WNDCLASS, *PWNDCLASS;
GetObject 根据背景画刷获取逻辑画刷
typedef struct tagLOGBRUSH {
UINT lbStyle;
COLORREF lbColor; //这里就是背景颜色
LONG lbHatch;
} LOGBRUSH,
或者用GetClassInfo 根据类名获取其WNDCLASS结构
typedef struct _WNDCLASS {
UINT style;
WNDPROC lpfnWndProc;
int cbClsExtra;
int cbWndExtra;
HINSTANCE hInstance;
HICON hIcon;
HCURSOR hCursor;
HBRUSH hbrBackground; //背景画刷
LPCTSTR lpszMenuName;
LPCTSTR lpszClassName;
} WNDCLASS, *PWNDCLASS;
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询