Print Page | Close Window

LoadSkin() + text color of check box

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Skin Framework
Forum Description: Topics Related to Codejock Skin Framework
URL: http://forum.codejock.com/forum_posts.asp?TID=9360
Printed Date: 14 May 2024 at 12:17am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: LoadSkin() + text color of check box
Posted By: znakeeye
Subject: LoadSkin() + text color of check box
Date Posted: 20 January 2008 at 10:18am
If I enable skinning via LoadSkin(), it seems impossible to change the text color of a check box in OnCtlColor().
 
How do I enforce a specific text color on my check box, preserving the skinned style for the actual check box?
 
As soon as I disable the call to LoadSkin(), the color is successfully set. This is driving me nuts!
 
Thanks!



Replies:
Posted By: Oleg
Date Posted: 21 January 2008 at 2:21am
Hi,
Do you use CDialog derived dialog ?


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: znakeeye
Date Posted: 21 January 2008 at 3:05am

No, CWnd-derived (code is based on CXTPColorSelectorCtrl) with a CButton in it. I also tried making it transparent, which turned out to be extremely hard.

All I want is the check box to be transparent, and its text white. I handle WM_CTLCOLOR and call SetTextColor(white), SetBkMode(TRANSPARENT). It works when XP Theme/XTP Skinning is disabled, otherwise the entire control becomes black.
I also tried calling SetWindowTheme(m_btnCheck.m_hWnd, L"", L""), but that didn't help.
 
I'm getting desperate :)


Posted By: Oleg
Date Posted: 23 January 2008 at 1:43pm
Hi,
I need sample project. too odd now. Send it to support@codejock.com


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: znakeeye
Date Posted: 24 January 2008 at 5:56pm

Just in case anybody wonders how to accomplish this; here's the final solution:

After creating the check box:
XTPSkinManager().Remove(m_checkBox.m_hWnd);
 
Then in OnCtlColor:
 
if (pWnd->GetDlgCtrlID() == IDC_CHECKBOX)
{
    pDC->SetTextColor(RGB(255, 0, 0));
    pDC->SetBkMode(TRANSPARENT);
    return (HBRUSH)m_patternBrush;
}
 
Where m_patternBrush is the pattern brush of the parent window from the window coordinates of the check box.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net