CStatic控件的背景色设为透明?

首页>200607053>200607030200607031200607032200607033200607034200607035200607036200607037

请问各位:怎样才能把 CStatic控件的背景色设为透明?主题:请问各位:怎样才能把CStatic控件的背景色设为透明?

顶楼内容: 我把对话框背景色设为一个图片,上面再放CStatic控件的时候,非常难看(因为CStatic有背景色,不透明,)

请问怎么做才能把CStatic控件的背景色设为透明?

第3楼

HBRUSHCTestDllDlg::OnCtlColor(CDC*pDC,CWnd*pWnd,UINTnCtlColor)

{

       HBRUSHhbr=CDialog::OnCtlColor(pDC,pWnd,nCtlColor);

       if(nCtlColor==CTLCOLOR_STATIC)

       {

              pDC->SetBkMode(TRANSPARENT);

              hbr=(HBRUSH)::GetStockObject(NULL_BRUSH);

       }

             

       //TODO:ChangeanyattributesoftheDChere

       //TODO:Returnadifferentbrushifthedefaultisnotdesired

       returnhbr;

}

原文地址:https://www.cnblogs.com/carl2380/p/1924669.html