C++ mfc学习疑问(1)

近期由于工作较清闲,准备开发一个对工作有帮助的小模块,由于长期接触web,和java 对C++很不熟悉。

从头学起。看到使用CDC画图一课时生出疑问。

void CLession4View::OnMouseMove(UINT nFlags, CPoint point) 
{
 // TODO: Add your message handler code here and/or call default
 //画线
//  CClientDC dc(this);
//  if (m_bdraw)
//  {
//   dc.MoveTo(m_beginpoint);
//   dc.LineTo(point);
//   m_beginpoint=point;
//  }
 if (m_bdraw)
 {
  RECT lpRect;
  ::GetClientRect(m_hWnd, &lpRect);
  CClientDC dc(this);
  CBrush *pBrush=CBrush::FromHandle((HBRUSH)GetStockObject(WHITE_BRUSH));
  CBrush *PoldBrush=dc.SelectObject(pBrush);
  int hight = lpRect.bottom - lpRect.top;  
  int width = lpRect.right - lpRect.left;  
  dc.Rectangle(0,0,width,hight);
  //CClientDC dc(this);
  dc.Rectangle(CRect(m_beginpoint,point));
  dc.SelectObject(PoldBrush);

 }

  CView::OnMouseMove(nFlags, point);
}

由于我刷新全页面,使每次重画都是新的一张图,

请问各位,怎么实现重叠?(要求有画画轨迹,即画的过程中图形一直存在,并不是画完才出现的)

请各位解答

posted on 2012-08-29 16:48  wang-tsh  阅读(353)  评论(5编辑  收藏  举报

导航