本文介绍了在CEdit控件上设置粗体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已成功更改了CEdit
控件的颜色和背景,但无法将其文本字体更改为 bold .
请帮助我完成此任务.
无论如何,谢谢.
I have sucessfully changed the color and the back ground of a CEdit
control, but I am unable to change its text font to bold.
Help me please to accomplish this.
Thank you anyway.
推荐答案
GetDlgItem(IDC_EDIT1)->SetFont(&m_editFont);
void makebold(HWND hwnd)
{
HFONT hFontB,hFont = (HFONT)SendMessage(hwnd,WM_GETFONT,0,0);
LOGFONT lf;
GetObject(hFont, sizeof(LOGFONT), &lf);
lf.lfWeight = FW_BOLD;
hFontB = CreateFontIndirect(&lf);
SendMessage(hwnd,WM_SETFONT,(int)hFontB,1);
}
要传递的参数是CEdit控件中的m_hWnd
.
The argument to pass is the m_hWnd
from your CEdit control.
这篇关于在CEdit控件上设置粗体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!