D
Danzellen
Guest
I'm trying to change the background color for the dialog in my MFC project, but nothing seems to be working. So far I have:
1) Added "CBrush m_brush" to the header public.
2) Added "m_brush.CreateSolidBrush(RGB(255, 0, 0))" on init.
3) Added OnCtlColor in Dlg.cpp.
HBRUSH CScheduleDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) {
HBRUSH hbr = CDialogEx::OnCtlColor(pDC, pWnd, nCtlColor);
hbr = m_brush;
return hbr;
}
(As well as "afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)" to the header protected)
The code runs, but the color is still blank. Is there anything else I can do?
Continue reading...
1) Added "CBrush m_brush" to the header public.
2) Added "m_brush.CreateSolidBrush(RGB(255, 0, 0))" on init.
3) Added OnCtlColor in Dlg.cpp.
HBRUSH CScheduleDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) {
HBRUSH hbr = CDialogEx::OnCtlColor(pDC, pWnd, nCtlColor);
hbr = m_brush;
return hbr;
}
(As well as "afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)" to the header protected)
The code runs, but the color is still blank. Is there anything else I can do?
Continue reading...