小编Bac*_*eam的帖子

在Win32中更改文本的字体

我一直在尝试使用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)

c++ winapi fonts

0
推荐指数
1
解决办法
1639
查看次数

标签 统计

c++ ×1

fonts ×1

winapi ×1