How can I set the backcolor of a control (equivilant of control.backcolor in .Net). I tried setBKColor with no luck.
ex: TabHwnd = createWindowEx(NULL,WC_TAB....
then how could I set the back color of TabHwnd?
Thanks
Windows will generate a message when it's painting the background of a control, and it is up to your program to respond to the message appropriately.
I know this question is old, but perhaps this answer will still help some others.
What worked for me was to return a hollow brush for the background color messages. For example:
switch (msg) {
case WM_CTLCOLORDLG:
return (INT_PTR)GetStockObject(HOLLOW_BRUSH);
case WM_CTLCOLORSTATIC:
return (INT_PTR)GetStockObject(HOLLOW_BRUSH);
}
Also, you don't need to worry about deleting the "brushes" created by GetStockObject.
尝试子类化(请参阅SetClassLong)并处理WM_ERASEBKGND
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.