展开全部
假设你的static控件ID为IDC_STATIC1:
然后重载对话框的WM_CTLCOLOR消息:
在OnCtlColor中添加如下代码:
HBRUSH CYourDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
// TODO: Change any attributes of the DC here
switch(pWnd->GetDlgCtrlID())
{
case IDC_STATIC1:
pDC->SetBkMode(TRANSPARENT);
pDC->SetTextColor(RGB(0,0,0));
return (HBRUSH)GetStockObject(HOLLOW_BRUSH);
default:
break;
}
// TODO: Return a different brush if the default is not desired
return hbr;
}
然后重载对话框的WM_CTLCOLOR消息:
在OnCtlColor中添加如下代码:
HBRUSH CYourDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
// TODO: Change any attributes of the DC here
switch(pWnd->GetDlgCtrlID())
{
case IDC_STATIC1:
pDC->SetBkMode(TRANSPARENT);
pDC->SetTextColor(RGB(0,0,0));
return (HBRUSH)GetStockObject(HOLLOW_BRUSH);
default:
break;
}
// TODO: Return a different brush if the default is not desired
return hbr;
}
展开全部
把控件的TRANSPARENT属性设为TRUE应该就行了吧
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
学习
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询