MFC中如何设置对话框上Static控件的背景
3个回答
展开全部
在CTCOLOR里面做
BRUSH CMyDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
switch(pWnd->GetDlgCtrlID())
{
case IDC_STATICC:
pDC->SetBkMode(TRANSPARENT);
pDC->SetTextColor(RGB(0,255,0));
return (HBRUSH)GetStockObject(HOLLOW_BRUSH);
break;
case IDC_STATICA:
pDC->SetBkMode(TRANSPARENT);
pDC->SetTextColor(RGB(84,226,95));
return (HBRUSH)GetStockObject(HOLLOW_BRUSH);
break;
case IDC_STATICB:
pDC->SetBkMode(TRANSPARENT);
pDC->SetTextColor(RGB(84,226,95));
return (HBRUSH)GetStockObject(HOLLOW_BRUSH);
break;
/* case IDC_STATICD:
pDC->SetBkMode(TRANSPARENT);
pDC->SetTextColor(RGB(0,255,0));
return (HBRUSH)GetStockObject(HOLLOW_BRUSH);
break; */
case IDC_EDIT1:
pDC->SetTextColor(RGB(0,0,0));
break;
case IDC_STATICQQQ:
pDC->SetBkMode(TRANSPARENT);
pDC->SetTextColor(RGB(84,226,95));
return (HBRUSH)GetStockObject(HOLLOW_BRUSH);
break;
}
return hbr;
}
BRUSH CMyDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
switch(pWnd->GetDlgCtrlID())
{
case IDC_STATICC:
pDC->SetBkMode(TRANSPARENT);
pDC->SetTextColor(RGB(0,255,0));
return (HBRUSH)GetStockObject(HOLLOW_BRUSH);
break;
case IDC_STATICA:
pDC->SetBkMode(TRANSPARENT);
pDC->SetTextColor(RGB(84,226,95));
return (HBRUSH)GetStockObject(HOLLOW_BRUSH);
break;
case IDC_STATICB:
pDC->SetBkMode(TRANSPARENT);
pDC->SetTextColor(RGB(84,226,95));
return (HBRUSH)GetStockObject(HOLLOW_BRUSH);
break;
/* case IDC_STATICD:
pDC->SetBkMode(TRANSPARENT);
pDC->SetTextColor(RGB(0,255,0));
return (HBRUSH)GetStockObject(HOLLOW_BRUSH);
break; */
case IDC_EDIT1:
pDC->SetTextColor(RGB(0,0,0));
break;
case IDC_STATICQQQ:
pDC->SetBkMode(TRANSPARENT);
pDC->SetTextColor(RGB(84,226,95));
return (HBRUSH)GetStockObject(HOLLOW_BRUSH);
break;
}
return hbr;
}
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
自定义控件的属性。。。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询