Transparent background and colored text for radio button
-
I am trying for a transpaerent radio button with colored text, i tried so many options by overwriting WM_CTRL_CLR or WM_ERASE_BKGND etcc.. its working for static and buttons but radio buttons not working... can any throw a light on this.. how we can do it
-
I am trying for a transpaerent radio button with colored text, i tried so many options by overwriting WM_CTRL_CLR or WM_ERASE_BKGND etcc.. its working for static and buttons but radio buttons not working... can any throw a light on this.. how we can do it
From comctrl6,if theme enabled you cannot change the text color of the raido button usign the WM_CTLCOLOR color. AFAIK, one thing we can do is, disable theme only for radio button. After this your code in the CTL color will work. eg:
SetWindowTheme( GetDlgItem( IDC_RAIOD_BTN_ID)->m_hWnd, L"", L"" );
where IDC_RAIOD_BTN_ID is the id of the radio buttonnave [My Articles] [My Blog]
-
I am trying for a transpaerent radio button with colored text, i tried so many options by overwriting WM_CTRL_CLR or WM_ERASE_BKGND etcc.. its working for static and buttons but radio buttons not working... can any throw a light on this.. how we can do it
Hope this may help 1.Create a CBrush member variable in Dialog class
CBrush m_brush;
2.In OnInitDialog, Create the brush with background color of the dialog
m_brush.CreateSolidBrush(RGB(200,100,0));
3.Handle the WM_CTLCOLOR message of the dialog and change the OnCtlColor function
HBRUSH CTestRadioDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
if(pWnd->GetDlgCtrlID()==IDC_RADIO1)
{
// Text Background
pDC->SetBkColor(RGB(200,100,0));
// Text color
pDC->SetTextColor(RGB(0,100,200));
return m_brush;
}
return CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
} -
I am trying for a transpaerent radio button with colored text, i tried so many options by overwriting WM_CTRL_CLR or WM_ERASE_BKGND etcc.. its working for static and buttons but radio buttons not working... can any throw a light on this.. how we can do it
Have you tried
CDC::SetBkMode(TRANSPARENT)
. Regards, Paresh.
-
I am trying for a transpaerent radio button with colored text, i tried so many options by overwriting WM_CTRL_CLR or WM_ERASE_BKGND etcc.. its working for static and buttons but radio buttons not working... can any throw a light on this.. how we can do it
What is the background of your dialog or window? A Image, or just filled with a color?
-
I am trying for a transpaerent radio button with colored text, i tried so many options by overwriting WM_CTRL_CLR or WM_ERASE_BKGND etcc.. its working for static and buttons but radio buttons not working... can any throw a light on this.. how we can do it