char* strFont = "Open Sans"; int nFontSize = 70; CHARFORMAT cfFormat; memset(&cfFormat, 0, sizeof(cfFormat)); cfFormat.cbSize = sizeof(cfFormat); cfFormat.dwMask = CFM_CHARSET | CFM_FACE | CFM_SIZE; cfFormat.bCharSet = ANSI_CHARSET; cfFormat.bPitchAndFamily = FIXED_PITCH | FF_DONTCARE; cfFormat.yHeight = (nFontSize * 1440) / 72; strcpy(cfFormat.szFaceName, strFont); CHARRANGE cr; cr.cpMin = INT_MAX; cr.cpMax = INT_MAX; SendDlgItemMessage(m_hWnd, IDE_EDITBOX, EM_SETCHARFORMAT, SCF_ALL, (LPARAM)&cfFormat); SendDlgItemMessage(m_hWnd, IDE_EDITBOX, EM_EXSETSEL, 0, (LPARAM)&cr); |
refer to:
https://gamedev.net/forums/topic/457546-rich-edit-controls-change-the-font-size-win32-c/457546/