2009-05-07 6 views

답변

2

새로운 CFont을 만들고 WM_SETFONT를 호출 할 수 있습니다. 이런 식으로 뭔가 : 당신은 내의 getFont()해야 물론

// note: m_font is a class variable of type CFont 
m_font.CreateFont(10, 0, 0, 0, FW_BOLD, 0, 0, 0, 0, 0, 0, 0, 0, "Arial") 
GetDlgItem(IDC_BUTTON1)->SendMessage(WM_SETFONT, WPARAM(HFONT(font)), 0); 
+3

- 그것을 기반으로 새 글꼴을, 버튼의>를 GetLogFont() LOGFONT 구조의 lfWeight 속성을 수정하고 만들 수 있습니다. – macbirdie

+0

감사합니다 @macbirdie, 정확히 내가 후속 조치를 취할 것입니다. –

11
class CYourDialog : CDialog 
{ 
public: 
    virtual BOOL OnInitDialog(); // override 

private: 
    CButton m_button; 
    CFont m_font; 
}; 

BOOL CYourDialog::OnInitDialog() 
{ 
     __super::OnInitDialog(); 

     CFont* font = m_button.GetFont(); 

     LOGFONT logFont; 
     font->GetLogFont(&logFont); 
     logFont.lfWeight = FW_BOLD; 

     m_font.CreateFontIndirect(&logFont); 
     m_button.SetFont(&m_font); 
} 
관련 문제