1. Add the font and color variable [cpp] public: CFont m_myFont; // font object COLORREF m_myColor; // color object 2. initialize the OnInitDialog () function in the dialog box () initialize the font and color [cpp] // TODO: add additional initialization code m_myFont.CreatePointFont (150, _ T (" 文 "); m_myColor = RGB (255, 0,255); 3. Add the WM_CTLCOLOR message response function for the dialog box class, and add the Code [cpp] afx_msg HBRUSH OnCtlColor (CDC * pDC, CWnd * pWnd, UINT nCtlColor); // message response function declaration [cpp] ON_WM_CTLCOLOR () // message ing [cpp] HBRUSH CXXXDlg: OnCtlColor (CDC * pDC, CWnd * pWnd, UINT nCtlColor) // message response function implementation {HBRUSH hbr = CDialog: OnCtlColor (pDC, pWnd, nCtlColor); // TODO: change any DC property here if (pWnd-> GetDlgCtrlID () = IDC_STATIC_WEEK) {pDC-> SelectObject (& m_myFont); // set the font pDC-> SetTextColor (m_myColor ); // set the color} // TODO: if the default paint brush is not required, return another paint brush return hbr ;}