Click here to Skip to main content
15,893,668 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi All,
I have a CPropertySheet with two CPropertyPages, I want to change the background color of "CPropertySheet". I can change the color of Whole area with OnCtlColor but a rectangle...!
I put a link Here that shows the uncolored rectangle, Please look at the link and tell me what should I do :( ??
Posted
Comments
Andrew Brock 19-Feb-11 6:25am    
I think you will find that rectangle comes from the WM_ERASEBKGND message sent to the TabCtrl. You can subclass the tab control by overwriting the MSGPROC, use SetWindowLong(GWL_MSGPROC).

Instead of using CPropertySheet and CPropertyPage you may try CTabCtrl.

You may check this to change the color by yourself:
http://support.microsoft.com/kb/179909[^]

Or this to download a zip file containing an implemention of a colored tab control (go at the bottom of the page to download the zip).
http://www.codeguru.com/forum/showthread.php?p=862173[^]

I hope this helps.
 
Share this answer
 
I downloaded the zip file, but it is not working for Dialog Based Projects. Am I right ??
 
Share this answer
 
Comments
Olivier Levrey 22-Feb-11 4:31am    
Post comments instead of answers, otherwise I can't receive emails. I just passed there because I was curious...
I didn't download the file, I will have a look and let you know.
Minoo Khazeni 22-Feb-11 5:09am    
Thanks anyway..., I'm waiting for your answer. :)
Olivier Levrey 22-Feb-11 5:12am    
Indeed I can't make it work for a dialog based project... it is strange :(
The interesting part for you is in CColoredTabsPS::OnInitDialog() (he changes the color for the tabs bar there). You can investigate there. I am sorry, I don't have any other idea...
Minoo Khazeni 22-Feb-11 5:58am    
thanks again.
I will try to solve this strange problem and I will inform you and others... :)
Finally I could find the solution,
For Dialog based projects, there were some codes at the end of stdafx.h that should be comment. Here are these codes:

#ifdef _UNICODE
#if defined _M_IX86
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"")
#elif defined _M_IA64
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='ia64' publicKeyToken='6595b64144ccf1df' language='*'\"")
#elif defined _M_X64
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"")
#else
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
#endif
#endif

After commenting these lines, problem with that rectangle will solve but a new problem will born :(. unfortunately all controls in the project will change to the older version of Visual....
I wish I could solve this problem in a better way.
 
Share this answer
 
Comments
aravindkrgec 23-Feb-11 3:33am    
I too amm searching for a better solution.So kindly update this forum if you have any development.
Minoo Khazeni 23-Feb-11 6:46am    
Of course I do...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900