如何更改组框的文本(标题)颜色? [英] how to change the group box's text(caption) color?
本文介绍了如何更改组框的文本(标题)颜色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
伙计们.
如何在MFC对话框中更改组框的文本(标题)颜色?
我使用VS2008,并且分组框的默认标题颜色为蓝色.
我想将蓝色更改为黑色.
以下是我的代码.但是没有效果.
Hi, guys.
How to change the text(caption) color of group box in dialog of MFC?
I use VS2008, and default caption color of group box is blue.
I want to change blue color to black color.
The following is my code. But there is no effect.
HBRUSH CTempDetDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
// TODO: Change any attributes of the DC here
if(pWnd->GetDlgCtrlID()==IDC_STA1) //group box''s id
{
pDC->SetBkColor(BLACK);
pDC->SetTextColor(RED);
pDC->SetBkMode(TRANSPARENT);
hbr = (HBRUSH)m_brush;
}
return hbr;
}
CBrush m_brush;
m_brush.CreateSolidBrush(BLACK);
请帮帮我.
谢谢.
Help me, pls.
Thanks.
推荐答案
写道:
我使用VS2008,默认标题颜色为组框为蓝色.
我想将蓝色更改为黑色.
I use VS2008, and default caption color of group box is blue.
I want to change blue color to black color.
实际上,您正在使用
进行设置
Actually you''re setting it with
写道:
pDC-> SetTextColor(RED);
pDC->SetTextColor(RED);
BTW:如何定义RED
符号?
:)
BTW: How is it defined RED
symbol?
:)
这篇关于如何更改组框的文本(标题)颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文