设置CEdit控件背景为透明C++MFC分类:Windows编程非发表文章代码片段2009-02-0717:30835人阅读评论(0)收藏举报viewplain1
HBRUSHCPenWidthsDlg::OnCtlColor(CDC*pDC,CWnd*pWnd,UINTnCtlColor)2
//Callthebaseclassimplementationfirst
Otherwise,itmay4
//undowhatwe''retryingtoaccomplishhere
HBRUSHhbr=CDialog::OnCtlColor(pDC,pWnd,nCtlColor);6
//ArewepaintingtheIDC_MYSTATICcontrol
Wecanuse8
//CWnd::GetDlgCtrlID()toperformthemostefficienttest
if(pWnd->GetDlgCtrlID()==IDC_EDIT)10
//Setthetextcolortored12
pDC->SetTextColor(RGB(255,0,0));13
//Setthebackgroundmodefortexttotransparent15
//sobackgroundwillshowthru
pDC->SetBkMode(TRANSPARENT);17
//ReturnhandletoourCBrushobject19
return(HBRUSH)::GetStockObject(NULL_BRUSH);20
returnhbr;23
}、MFC中Static控件透明,重影,长度问题2011-06-1023:11做MFC编程,Static控件是会经常用到的了,而使Static控件背