C++文本框字体
C++ textbox font
我在C++(Win32)中制作了一个文本框现在我想更改文本框的形式和字体,因为它看起来很难看我是怎么做的?
这就是我创建文本框的方式
HWND WindowManager::textbox(int width, int height, int xPos, int yPos, LPCSTR content, bool edit_able)
{
int type = (edit_able) ? (WS_CHILD|WS_VISIBLE|ES_AUTOHSCROLL) : (WS_CHILD|WS_VISIBLE|WS_HSCROLL|ES_AUTOHSCROLL);
return CreateWindowEx(
WS_EX_CLIENTEDGE,
"EDIT",
content,
type,
xPos,
yPos,
width,
height,
window,
(HMENU)50,
GetModuleHandle(NULL),
NULL
);
}
几个Windows控件都是用丑陋的系统字体初始化的——如果你想要好看的控件,你必须自己更改字体,如下所示:
// create the text box
HWND hTextBox = CreateWindowEx(...);
// initialize NONCLIENTMETRICS structure
NONCLIENTMETRICS ncm;
ncm.cbSize = sizeof(ncm);
// obtain non-client metrics
SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(ncm), &ncm, 0);
// create the new font
HFONT hNewFont = CreateFontIndirect(&ncm.lfMessageFont);
// set the new font
SendMessage(hTextBox, WM_SETFONT, (WPARAM)hNewFont, 0);
WM_SETFONT
消息就是您要查找的。
相关文章:
- 文本文件中的单词链表
- 更改 Windows GUI 中静态文本框的字体大小
- ExtTextOut 文本的持续闪烁,在一段时间后,文本将恢复为默认字体
- ID3DXFont :文本被拉伸,如何获取字体的宽度和高度?
- 如何使用X11中的XFT字体在窗口中央对齐文本
- Qt:用不同的字体绘制文本
- 我无法更改 html 文本字体大小Fl_Help_View
- 我如何更改文本浏览器中先前编写的文本的字体大小
- 如何在 DirectWrite 中使用默认 UI 字体绘制文本
- 字体大小正确的文本C++Api hDC
- C++文本框字体
- Win32:设置富编辑的默认字体和文本颜色
- 使用 WinAPI 使用可变字体/格式的文本自动换行块
- 如何在绘图文本上更改字体大小
- 缩小文本字体以适应TLabel
- 在Unix文本文件中使用多种字体
- 如何改变静态文本控件的字体(winapi)
- Direct2D/DirectDraw将只绘制文本与Arial字体
- 使 QMessageBox 信息文本加粗并增加字体大小
- 如何确定CRichEditCtrl中所选文本是否具有多种字体大小