#includeCFont font; font.CreateFont(18, 10, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE, L"Arial");
#includeThis example shows how to use the created font to draw text on a device context (HDC). In this example, the font is selected into the HDC before drawing with it. The color and background mode for the text output are also set before calling the TextOut function. The package library for CFont is likely the Windows API as it is commonly used in GUI frameworks on the Windows operating system.void DrawWithFont(HDC hdc, CFont font) { font.SelectObject(hdc); SetTextColor(hdc, RGB(0, 0, 255)); SetBkMode(hdc, TRANSPARENT); const wchar_t str[] = L"Hello, world!"; TextOut(hdc, 10, 10, str, sizeof(str) / sizeof(wchar_t) - 1); }