我建立了一个单文档程序,并把窗口分割成了2个子窗口,左边是树形目录,右边是用来显示文字的,右边的子窗口派生于CEditView,并且里面的文字是用SetWindowText输出的,我现在要改变里面文字的颜色和字体。不知道怎么改,试了N种方法没一个行。我在崩溃的边缘。
问题补充:OnCtrlColore消息我用过,不能改,如果用TextOut可以用OnCtrlColore消息改颜色。但用SetWindowText不行
问题补充:OnCtrlColore消息我用过,不能改,如果用TextOut可以用OnCtrlColore消息改颜色。但用SetWindowText不行
BEGIN_MESSAGE_MAP(CYourView, CEditView)
ON_WM_CTLCOLOR_REFLECT()
END_MESSAGE_MAP()HBRUSH CYourView::CtlColor(CDC* pDC, UINT nCtlColor)
{
pDC->SetTextColor(RGB(255,255,0));
pDC->SetBkColor(RGB(0,0,255));
return CreateSolidBrush(RGB(0,0,255));
}
void CEditPaneView3::OnInitialUpdate()
{
CEditView::OnInitialUpdate();
// TODO: Add your specialized code here and/or call the base class
SetWindowText("算法设计");
}
HBRUSH CEditPaneView3::CtlColor(CDC* pDC, UINT nCtlColor)
{
// TODO: Change any attributes of the DC here
pDC->SetTextColor( RGB(255,0,0) );//设置文本颜色 pDC->SetBkColor( RGB(0,255,0) );//设置背景颜色
// TODO: Return a non-NULL brush if the parent's handler should not be called
return NULL;
}
pDC->SetTextColor(RGB(255,255,0));
pDC->SetBkColor(RGB(0,0,255));
return CreateSolidBrush(RGB(0,0,255));