MFC: Change the color of static text with button press?
I've got some text that I want to change from red to green when the user pushes a button. Currently, I'm coloring the text like so:
// in OnInitDialog:
Code:
m_brush.CreateSolidBrush(RGB(50, 50, 50));
Code:
HBRUSH CCineFrameDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
if (pWnd->GetDlgCtrlID() == 0x200 ||
pWnd->GetDlgCtrlID() == IDC_STATIC_COLOR)
{
pDC->SetTextColor(RGB(200,0,0));
pDC->SetBkMode(TRANSPARENT);
hbr = m_brush;
}
return hbr;
}
Two questions -
1. how go I make it change with the button press?
2. How do I get it to actually look transparent (as opposed to the attached with the dark background behind the text)? Is there a way to get the background color of the window & set the brush to the color as a default?