我感觉我这逻辑也没有错误呀,
void CPICSHOWView::OnLButtonDown(UINT nFlags, CPoint point) 
{
// TODO: Add your message handler code here and/or call default
if (flag)//在点击漫游时flag设为true
{
     m_beginp=point;//保存开始点
             lbuttondown=TRUE;

}
CView::OnLButtonDown(nFlags, point);
}
void CPICSHOWView::OnMouseMove(UINT nFlags, CPoint point) 
{
// TODO: Add your message handler code here and/or call default
if (lbuttondown==TRUE&&flag==true)
{
CPoint p;
p.x=point.x-m_beginp.x;
p.y=point.y-m_beginp.y;
m_npoint.x = m_npoint.x+p.x;//设置图片显示的左上角坐标
             m_npoint.y = m_npoint.y+p.y;
Invalidate();
}

CView::OnMouseMove(nFlags, point);
}
void CPICSHOWView::OnLButtonUp(UINT nFlags, CPoint point) 
{
// TODO: Add your message handler code here and/or call default
lbuttondown==FALSE;
CView::OnLButtonUp(nFlags, point);
}
为什么点击漫游之后图片是可以移动,但是轨迹貌似有点问题,而且当响应OnLButtonUp之后移动一下鼠标图片就没了,这是为什么呀?还请懂的给小弟答复一下!

解决方案 »

  1.   

    p.x=point.x-m_beginp.x;
    p.y=point.y-m_beginp.y;后面加一句
    m_beginp=point;
      

  2.   

    void CPICSHOWView::OnLButtonDown(UINT nFlags, CPoint point)  
    {
    // TODO: Add your message handler code here and/or call default
    if (flag)//在点击漫游时flag设为true
    {
      m_beginp=point;//保存开始点
      lbuttondown=TRUE;}
    //CView::OnLButtonDown(nFlags, point);调用父的函数似乎没什么意义,浪费CPU周期
    }
    void CPICSHOWView::OnMouseMove(UINT nFlags, CPoint point)  
    {
    // TODO: Add your message handler code here and/or call default
    if (lbuttondown==TRUE&&flag==true)
    {
    int dx,dy;
    dx=point.x-m_beginp.x;
    dy=point.y-m_beginp.y;  m_npoint.x = m_npoint.x+dx;//设置图片显示的左上角坐标
      m_npoint.y = m_npoint.y+dy;  m_beginp=point //为下次设置起始参照点  Invalidate();
    }//CView::OnMouseMove(nFlags, point);
    }void CPICSHOWView::OnLButtonUp(UINT nFlags, CPoint point)  
    {
    // TODO: Add your message handler code here and/or call default
     lbuttondown==FALSE;
    //CView::OnLButtonUp(nFlags, point);
    }
      

  3.   

    有兴趣的话可以看看这个
    http://blog.csdn.net/xianglitian/article/details/6023656