设置Cstatic控件背景透明

来源:互联网 发布:阿里云流量包 编辑:程序博客网 时间:2024/05/23 23:03

1.控件选中transparent属性

2.HBRUSH CWaitDialog::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
    HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
   
    // TODO: Change any attributes of the DC here
   
    // TODO: Return a different brush if the default is not desired

     if (nCtlColor == CTLCOLOR_STATIC)
    {
        pDC-> SetBkMode(TRANSPARENT); //透明

        return (HBRUSH)::GetStockObject(NULL_BRUSH);
    }
    return hbr;
}

原创粉丝点击