void printtptext(HWND hwnd, int x, int y, int cHeight, int cWidth, LPCWSTR lpString, COLORREF color, LPCWSTR pszFaceName)
{
HDC hdc = GetDC(hwnd);//获取设备上下文的句柄
SetBkMode(hdc, TRANSPARENT);
SetTextColor(hdc, color);
HFONT font = CreateFont(cHeight, cWidth, 0, 0, FW_NORMAL, FALSE, FALSE, 0, ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_SWISS, pszFaceName);
SelectObject(hdc, font);
TextOut(hdc, x, y, lpString, wcslen(lpString));
}
C++输出透明背景字体
最新推荐文章于 2024-04-02 19:46:06 发布