I managed to get custom text color in REC, but I can't make it to use the desired font (Consolas).
(EDIT) Creating REC:
LoadLibrary(TEXT("Msftedit.dll"));
hEdit = CreateWindowEx(WS_EX_CLIENTEDGE, MSFTEDIT_CLASS, L"",
WS_CHILD | WS_VISIBLE | ES_MULTILINE,
0, 0, 300, 300,
hwnd, NULL, GetModuleHandle(NULL), NULL);
-
CHARFORMAT cf = {};
cf.cbSize = sizeof(CHARFORMAT);
cf.dwMask = CFM_COLOR | CFM_FACE;
cf.crTextColor = RGB(255, 0, 255);
cf.bPitchAndFamily = DEFAULT_PITCH | FF_MODERN;
memcpy(cf.szFaceName, L"Consolas", sizeof(L"Consolas"));
SendMessage(hEdit, EM_SETCHARFORMAT, NULL, (LPARAM)&cf);
I'm using
#ifndef UNICODE
#define UNICODE
#endif
Few answers that i found but didn't help me much... Win32 : set default font and text color for rich edit, How to set a font in rich edit 4?
Note: the REC has no text in it
This is what i get... 5 'i' and 5 '0' should have same spacing with Consolas, Right?