2015년 2월 10일 화요일

[MFC] CStatic 투명

HBRUSH CEdgeNotifyWindow::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CWnd::OnCtlColor(pDC, pWnd, nCtlColor);


switch(nCtlColor)
    {
    case CTLCOLOR_STATIC:
        {
if(pWnd->GetDlgCtrlID() == m_Label.GetDlgCtrlID())
            {
                //pDC->SetTextColor(RGB(255, 0, 0));
                pDC->SetBkMode(TRANSPARENT);
                return (HBRUSH)GetStockObject(NULL_BRUSH);;
            }
        }
    }
// TODO:  Return a different brush if the default is not desired
return hbr;
}