void OnDrop( CPoint& point ){ if( m_bDragging ) { ::ReleaseCapture(); m_bDragging = FALSE; m_pDragImage->DragLeave( CWnd::GetDesktopWindow() ); m_pDragImage->EndDrag(); CPoint pt(point); ClientToScreen( &pt ); CWnd* pDropWnd = CWnd::WindowFromPoint( pt ); ASSERT(pDropWnd); if( pDropWnd->IsKindOf(RUNTIME_CLASS(CTreeCtrl)) ) { DropItemOnTree( (CTreeCtrl*)pDropWnd ); } else if( pDropWnd->IsKindOf(RUNTIME_CLASS(CListCtrl)) ) { DropItemOnList( (CListCtrl*)pDropWnd ); } } }
void CSpiroView::OnMouseMove(UINT nFlags, CPoint point) { if (m_bMovingPencil || m_pFigureDrag != NULL) // the user is dragging the pencil location { CPoint ptWindow(point); ClientToScreen(&ptWindow); CRect rectWindow; GetWindowRect(&rectWindow); ptWindow.Offset(-rectWindow.left, -rectWindow.top); CImageList* pImList = m_bMovingPencil? &GetApp()->m_imageList : m_pILDragFigure; ENSURE(pImList != NULL); if (m_bStartDrag) { ENSURE(m_pFigureDrag != NULL); m_bStartDrag = false; CSpiroRect rect; m_pFigureDrag->GetBoundingRect(&rect); rect.Scale(m_nZoomNumer, m_nZoomDenom); CDC* pDC = GetDC(); ENSURE(pDC != NULL); OnPrepareDC(pDC); pDC->LPtoDP(&rect); ReleaseDC(pDC); rect.InflateRect(4, 4); InvalidateRect(&rect); pImList->DragLeave(this); UpdateWindow(); pImList->DragEnter(this, ptWindow); } else pImList->DragMove(ptWindow); return; } CScrollView::OnMouseMove(nFlags, point); }