color the text of radio button
-
Hi all, i will thank in advance for your help. I want to color the text of radio button, using OnCtlColor but the color doesn't change. anyone know how i can color the text? this is a part of my Dialog box HBRUSH CMyDialog::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) { HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor); if( (pWnd->GetDlgCtrlID() == IDC_RADIO1) || (pWnd->GetDlgCtrlID() == IDC_RADIO2) ) { pDC->SetTextColor(((CEstoApp*)AfxGetApp())->GetSfondoTesti()); pDC->SetBkMode(TRANSPARENT); } return hbr; } Thanks to all
-
Hi all, i will thank in advance for your help. I want to color the text of radio button, using OnCtlColor but the color doesn't change. anyone know how i can color the text? this is a part of my Dialog box HBRUSH CMyDialog::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) { HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor); if( (pWnd->GetDlgCtrlID() == IDC_RADIO1) || (pWnd->GetDlgCtrlID() == IDC_RADIO2) ) { pDC->SetTextColor(((CEstoApp*)AfxGetApp())->GetSfondoTesti()); pDC->SetBkMode(TRANSPARENT); } return hbr; } Thanks to all
Try returning brush of color you want.
HBRUSH CMyDialog::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);if( (pWnd->GetDlgCtrlID() == IDC_RADIO1) ||
(pWnd->GetDlgCtrlID() == IDC_RADIO2) )
{
hbr = CreateSolidBrush(...);
}return hbr;
}Prasad Notifier using ATL | Operator new[],delete[][^]
-
Hi all, i will thank in advance for your help. I want to color the text of radio button, using OnCtlColor but the color doesn't change. anyone know how i can color the text? this is a part of my Dialog box HBRUSH CMyDialog::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) { HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor); if( (pWnd->GetDlgCtrlID() == IDC_RADIO1) || (pWnd->GetDlgCtrlID() == IDC_RADIO2) ) { pDC->SetTextColor(((CEstoApp*)AfxGetApp())->GetSfondoTesti()); pDC->SetBkMode(TRANSPARENT); } return hbr; } Thanks to all
This code is working
HBRUSH CAnswer::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) { HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor); if(pWnd->GetDlgCtrlID() == IDC_RADIO1) pDC->SetTextColor(RGB(53,97,220)); return hbr; }
WhiteSky
-
This code is working
HBRUSH CAnswer::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) { HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor); if(pWnd->GetDlgCtrlID() == IDC_RADIO1) pDC->SetTextColor(RGB(53,97,220)); return hbr; }
WhiteSky
-
thank for your answer, in fact the code is working, maybe in my case is not working because i use a resource that implement XP STYLE and maybe this is why the code in my program is not working. thank a lot
Maybe I had a problem like this but with ComboBox:)
WhiteSky