MFC对话框OnPaint函数设置位图为透明函数为何,内存错误????
voidCJune22_tooltestDlg::OnPaint(){CPaintDCdc(this);CRectrect;GetClientRect(&rect);CD...
void CJune22_tooltestDlg::OnPaint()
{
CPaintDC dc(this);
CRect rect;
GetClientRect(&rect);
CDC *pDC=GetDC();
CDC memdc;
memdc.CreateCompatibleDC(pDC);
CBitmap bitmap;
bitmap.LoadBitmap(IDB_BITMAP2);
CBitmap* pOldImageBMP = (CBitmap*)memdc.SelectObject(bitmap);
TransparentBlt(pDC->m_hDC,x,y,rect.Width(),rect.Height(), memdc.m_hDC, x,y,rect.Width(),rect.Height(), RGB(0,0,0xff));
memdc.SelectObject(pOldImageBMP);
CDialogEx::OnPaint();
} 展开
{
CPaintDC dc(this);
CRect rect;
GetClientRect(&rect);
CDC *pDC=GetDC();
CDC memdc;
memdc.CreateCompatibleDC(pDC);
CBitmap bitmap;
bitmap.LoadBitmap(IDB_BITMAP2);
CBitmap* pOldImageBMP = (CBitmap*)memdc.SelectObject(bitmap);
TransparentBlt(pDC->m_hDC,x,y,rect.Width(),rect.Height(), memdc.m_hDC, x,y,rect.Width(),rect.Height(), RGB(0,0,0xff));
memdc.SelectObject(pOldImageBMP);
CDialogEx::OnPaint();
} 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询