直接派生CEdit改变CEdit字体颜色

来源:互联网 发布:钢结构节点计算软件 编辑:程序博客网 时间:2024/04/29 23:37

在派生类中重载消息OnChildNotify,可以改变字体的颜色

BOOL CMyEdit::OnChildNotify(UINT message, WPARAM wParam, LPARAM lParam, LRESULT* pLResult) 
{
// TODO: Add your specialized code here and/or call the base class
if(message!=WM_CTLCOLOREDIT)
{
return CEdit::OnChildNotify(message, wParam, lParam, pLResult);
}
else
{
HDC hdc=(HDC)wParam;
SetTextColor(hdc,0X8000);
return TRUE;
}
}