[MFC] Static Text 글자 색상, 배경 색상 바꾸기
HBRUSH CDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) { HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor); // TODO: Change any attributes of the DC here if (pWnd->GetDlgCtrlID() == IDC_STATIC_RESULT) { if (m_bResult == TRUE) { pDC->SetTextColor(RGB(0, 0, 0)); pDC->SetBkColor(RGB(0, 255, 0)); hbr = ::CreateSolidBrush(RGB(0, 255, 0)); } else { pDC->SetTextColor(RGB(255, 255, 0)); pDC->SetBkColor(RGB(255, 0, 0)); hbr = ::CreateSolidBrush(RGB(255, 0, 0)); } } // TODO: Return a different brush if the default is not desired return hbr; }