假設客戶的需求是希望UI的字體大小能在 runtime 時決定, 此時我們有兩種方式來修改font size: (這裡使用TextControl IDC_STATIC_1) 為例子 Way 1. 取得UI上的控件, 並呼叫SetFont() CFont m_font; / /設定大小為 4 m_ font.CreatePointFont (40 , L"Arial" ); //取得UI上的控件, 並呼叫SetFont() GetDlgItem ( IDC_STATIC_1 )->SetFont(m_font); Way 2. 透過 息映射(message mapping)函數 ON_WM_CTLCOLOR Step 1.宣告訊息映射(message mapping)函數 BEGIN_MESSAGE_MAP(CTestDlg, CDialog) ... ON_WM_CTLCOLOR( ) ... END_MESSAGE_MAP() Step 2. 實作回呼函式 OnCtlColor HBRUSH CTestDlg :: OnCtlColor ( CDC * pDC, CWnd * pWnd, UINT nCtlColor ) { HBRUSH hbr = CDialog :: OnCtlColor ( pDC, pWnd, nCtlColor ) ; if ( p...