描述:
如题,我加入了onlbuttondown,onlbuttonup,onmousemove,为什么不能拖动呢?请赐教!代码如下:void CCardsCtrl::OnLButtonDown(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
if(IsMove) {
m_IsMove=true;
SetCapture();
xx=point.x;
yy=point.y;
GetClientRect(&rect);
::ClientToScreen(m_hWnd,&rect.TopLeft());
OldPoint=rect.TopLeft();
MoveWindow(0,0,71,96);
GetClientRect(&rect);
::ClientToScreen(m_hWnd,&rect.TopLeft());
}
COleControl::OnLButtonDown(nFlags, point);
}
void CCardsCtrl::OnMouseMove(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
CPoint MyPoint=point;
if(m_IsMove)
{
ClientToScreen(&MyPoint);
MoveWindow(MyPoint.x-xx-rect.left,MyPoint.y-yy-rect.top,71,96);
}
COleControl::OnMouseMove(nFlags, point);
}
void CCardsCtrl::OnLButtonUp(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
if(m_IsMove)
{
ReleaseCapture();
m_IsMove=false;
if(IsGoHome)
MoveWindow(OldPoint.x-rect.left,OldPoint.y-rect.top,71,96);
}
COleControl::OnLButtonUp(nFlags, point);
}