MFC我设置了对话框背景,但是如何让静态文本框控件的背景也是那个对话框背景啊,我是白白的背景一条灰啊
展开全部
HBRUSH CMyDialog::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
if ((nCtlColor == CTLCOLOR_DLG)||(nCtlColor == CTLCOLOR_STATIC)||(nCtlColor == CTLCOLOR_BTN))
{
pDC->SetBkMode(TRANSPARENT);
pDC->SetBkColor(COLOR_WHITE);
return m_bkDlgBrush;
}
}
{
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
if ((nCtlColor == CTLCOLOR_DLG)||(nCtlColor == CTLCOLOR_STATIC)||(nCtlColor == CTLCOLOR_BTN))
{
pDC->SetBkMode(TRANSPARENT);
pDC->SetBkColor(COLOR_WHITE);
return m_bkDlgBrush;
}
}
追问
COLOR_WHITE提示没有定义,m_bkDlgBrush提示没有定义,哥们这两个怎么搞定
追答
#define COLOR_WHITE RGB(255,255,255)
HBRUSH m_bkDlgBrush;类变量
构造里实现
m_bkDlgBrush=CreateSolidBrush(COLOR_WHITE);//你的颜色,,
析构里销毁
if (m_bkBrush != NULL)
{
DeleteObject(m_bkBrush);
m_bkBrush = NULL;
}
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询