1
C / C++ / Re: Static Text Control Font Size
« on: April 02, 2009, 05:47 AM »I was trying to work out how to do this myself recently and came up with another method as Visual Studio didn't seem to want to let me create a control variable for a static text control within a dialog.
Code: C++ [Select]
- CFont* g_hFont = NULL;
- ...
- case WM_INITDIALOG:
- {
- if (g_hFont)
- {
- delete g_hFont;
- g_hFont = NULL;
- }
- g_hFont = new CFont;
- g_hFont->CreatePointFont(140, _T("Verdana"));
- CWnd::FromHandle(GetDlgItem(hDlg, IDC_STATIC_NAME))->SetFont(g_hFont, TRUE);
- return (INT_PTR)TRUE;
- }
- ...