2008/05/20 23:44

[MFC Copy Code] 마우스 이벤트, 드래그시 화면 객체를 상태 좌표로 이동시키기

void CGDITestView::OnLButtonDown(UINT nFlags, CPoint point)
{
 SetCapture();

 m_oldPoint = point;

 CView::OnLButtonDown(nFlags, point);
}

void CGDITestView::OnLButtonUp(UINT nFlags, CPoint point)
{
 ReleaseCapture();

 CView::OnLButtonUp(nFlags, point);
}

void CGDITestView::OnMouseMove(UINT nFlags, CPoint point)
{
 if( GetCapture() == this )
 {
  m_realPos += (point - m_oldPoint);
  m_oldPoint = point;

  Invalidate();
 }

 CView::OnMouseMove(nFlags, point);
}

크리에이티브 커먼즈 라이선스
Creative Commons License
Trackback 0 Comment 0