How to change font on CButton?
C / C++ / MFC
1
Posts
1
Posters
0
Views
1
Watching
-
Hi. I created a CButton on a window and want to change the font of text on CButton. I tried as follows but dint work.
CFont m_Font;
LOGFONT lf; memset(&lf, 0, sizeof(LOGFONT)); // zero out structure lf.lfHeight = 12; // request a 12-pixel-height font strcpy((char\*)lf.lfFaceName, "Arial"); // request a face name "Arial" VERIFY(m\_Font.CreateFontIndirect(&lf)); // create the font m\_but.Create(\_T("Sheet1"), BS\_PUSHBUTTON, CRect(0, 0, 70, 30), this, 101); m\_but.SetFont(&m\_Font); m\_but.ShowWindow(SW\_SHOW);
May i know what i am missing?