mfc图片显示,鼠标拖图片时会有很多残影,我是想拖动图片的副本到对话框外原图还在,怎么去残影。
原图我是用picturecontrol显示的一张磁盘里的本地图片拖动的时候用了m_hbmpvoidCDlgDragPlane::DrawImage(intx,inty,C...
原图我是用picture control显示的一张磁盘里的本地图片
拖动的时候用了m_hbmp
void CDlgDragPlane::DrawImage(int x,int y,CDC* pDC)
{//x,y 是屏幕坐标
HBITMAP OldBitmap; CDC MemDC;MemDC.CreateCompatible(pDC);
OldBitmap=(HBITMAP)MemDC.SelectObject(m_hbmp);
CRect rect;GetClientRect(&rect);
pDC->BitBlt(x,y,rect.Width(),rect.Height(),&MemDC,0,0,SRCCOPY);
MemDC.SelectObject(OldBitmap);
}
void CDlgDragPlane::OnMouseMove(UINT nFlags,CPoint point)
{
if(m_bcapture)//判断选中图片
{
CDC dc;dc.m_hDC=::Get(NULL);
ClientToScreen(&point);
DrawImage(point.x,point.y,&dc);
}
CDialog::OnMouseMove(UINT nFlags,CPoint point);
} 展开
拖动的时候用了m_hbmp
void CDlgDragPlane::DrawImage(int x,int y,CDC* pDC)
{//x,y 是屏幕坐标
HBITMAP OldBitmap; CDC MemDC;MemDC.CreateCompatible(pDC);
OldBitmap=(HBITMAP)MemDC.SelectObject(m_hbmp);
CRect rect;GetClientRect(&rect);
pDC->BitBlt(x,y,rect.Width(),rect.Height(),&MemDC,0,0,SRCCOPY);
MemDC.SelectObject(OldBitmap);
}
void CDlgDragPlane::OnMouseMove(UINT nFlags,CPoint point)
{
if(m_bcapture)//判断选中图片
{
CDC dc;dc.m_hDC=::Get(NULL);
ClientToScreen(&point);
DrawImage(point.x,point.y,&dc);
}
CDialog::OnMouseMove(UINT nFlags,CPoint point);
} 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询