您的位置:首页 > 其它

为Edit控件添加指定位图背景

2011-03-31 14:09 253 查看
BOOL CMyEdit::OnEraseBkgnd(CDC* pDC)
{
// TODO: Add your message handler code here and/or call default
//**************************************************************************************

//取消文字复选
this->SetSel(0,0);

//设置位图背景
CBitmap bitmap;
bitmap.LoadBitmap(IDB_BITMAP1);

BITMAP bmp;
bitmap.GetBitmap(&bmp);

CDC dcCompatible;
dcCompatible.CreateCompatibleDC(pDC);

dcCompatible.SelectObject(&bitmap);

CRect rect;
GetClientRect(&rect);
pDC->BitBlt(0,0,rect.Width(),rect.Height(),&dcCompatible,0,0,SRCCOPY);
return TRUE;
//*********************************************************************************
//CEdit::OnEraseBkgnd(pDC);
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: