VC控件背景透明

来源:互联网 发布:matlab 2014a for mac 编辑:程序博客网 时间:2024/05/18 03:29


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


// TODO:  Change any attributes of the DC here
if (nCtlColor==CTLCOLOR_STATIC)
{
CDC *pBkDC = GetDC(); //拷贝背景 ;
//pDC->BitBlt(0, 0, rcCtrl.Width(), rcCtrl.Height(),     
// pBkDC, rcCtrl.left, rcCtrl.top, SRCCOPY);  
pDC-> SetTextColor(RGB(0,0,0)); //字体颜色;
pDC-> SetBkMode(TRANSPARENT);// 背景透明;
ReleaseDC( pBkDC ); //释放ClientDC  
return HBRUSH(GetStockObject(NULL_BRUSH));
}
// TODO:  Return a different brush if the default is not desired
return hbr;
}
0 0
原创粉丝点击