MFC单文档拖动图片问题,很闪怎么办
void CDiViewView::OnDraw(CDC* pDC)
{
CDiViewDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
//CDiViewDoc* pDoc = GetDocument();
//ASSERT_VALID(pDoc);
CRect rectClient;
CBrush brushBkColor;
GetClientRect(rectClient);
brushBkColor.CreateSolidBrush(RGB(0,0,0));
pDC->DPtoLP(rectClient);
pDC->FillRect(rectClient,&brushBkColor);
}
void CDiViewView::OnPaint()
{
CPaintDC dc(this); // device context for painting
if(draw==true)//鼠标按下并移动需要ondraw,其他时间都不需要ondraw()
{OnDraw(&dc);}
float wandh;
int oldStretchBltMode;
oldStretchBltMode=dc.SetStretchBltMode(COLORONCOLOR);
wandh=((float)dib.GetWidth())/((float)dib.GetHeight());
CRect rect;
GetClientRect(&rect);
dib.Display(&dc,m_121,m_122,300*wandh,300,0,0,dib.GetWidth(),dib.GetHeight dc.SetStretchBltMode(oldStretchBltMode);//m_121,m_122为获取鼠标移动坐标。
}
大侠们救命,不用OnDraw()的话,画面乱成一团,用OnDraw()的话,移动图片的时候又很闪,怎么办啊?