我一直在尝试使用Win32 API更改窗口中的输出字体.这是我做的,但它不起作用.我该怎么办?
hdc = BeginPaint(hWnd, &ps);
hFont = CreateFont(y_position, closest_match, escapement, orientation, FW_DONTCARE,
no_italic, no_ul, no_xout, ANSI_CHARSET,
OUT_TT_PRECIS, CLIP_DEFAULT_PRECIS, DRAFT_QUALITY, VARIABLE_PITCH,
TEXT("Tekton Pro")/*"SYSTEM_FIXED_FONT"*/);
SetTextColor(hdc, RGB(255, 0, 0));
TextOut(hdc, 50, y_position, TEXT("test"), strlen("test"));
// TODO: Add any drawing code that uses hdc here...
EndPaint(hWnd, &ps);
DeleteObject(hFont);
Run Code Online (Sandbox Code Playgroud)