MFC change control color - EnableThemeDialogTexture
I have changed main dialog's background color in OnEraseBkgnd to white but all my controls have still gray background. I tried setting their Transparent parameter to true but it makes no difference.
I also changed manifest so program uses XP style.
Any ideas?
Thanks!
[Edited by - davidcoleman on December 25, 2008 3:09:27 PM]
Hi,
Your dialog can handle the ON_WM_CTLCOLOR() message.
The message handler is OnCtlColor, see http://msdn.microsoft.com/en-us/library/0wwk06hc(VS.80).aspx
You'll want to do something like:
Your dialog can handle the ON_WM_CTLCOLOR() message.
The message handler is OnCtlColor, see http://msdn.microsoft.com/en-us/library/0wwk06hc(VS.80).aspx
You'll want to do something like:
HBRUSH FooDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor){ HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor); //Get the ID of the window for which the message is being handled int nID = pWnd->GetDlgCtrlID(); //check the control type if (nCtlColor == CTLCOLOR_BTN ) { if(nID==IDC_COLOREDBUTTON) { pDC->SetBkColor( RGB(255,255,255) ); } } return hbr;}
Hi
I tried it and also tried excluding both ifs to change back color of everything , but not all elements are affected... for example trackbars have still ugly background.
I am also trying to place them on tab control and make EnableThemeDialogTexture Function work, but without success. Any experience with that?
I tried it and also tried excluding both ifs to change back color of everything , but not all elements are affected... for example trackbars have still ugly background.
I am also trying to place them on tab control and make EnableThemeDialogTexture Function work, but without success. Any experience with that?
I did make EnableThemeDialogTexture function work. Now all controls have the color of the tabControl ... sort of...
Since XP styled Tab has gradient background, controls placed on top have still noticeable different color, but controls on bottom of the tab smoothly blend with tabcolor
I can not override ON_WM_CTLCOLOR since then if I make everything draw transparent I end up with their background color black
Any ideas?
Since XP styled Tab has gradient background, controls placed on top have still noticeable different color, but controls on bottom of the tab smoothly blend with tabcolor
I can not override ON_WM_CTLCOLOR since then if I make everything draw transparent I end up with their background color black
Any ideas?
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement