程序中调用了CChartCtrl这个开源代码作图,本人还是学习阶段,代码基本是参考网站提供的demo版本的。不同的是例子中是基于对话框的程序,我的是基于单文档的程序,那个自定义空间就放在FormView中。调用没有问题了,但是当鼠标移到作图区域,程序就意外终止了。CChartCtrl中是用OnMouseMove的函数的,是自动调用的。 我不知道为什么例子中就没有问题,我的鼠标移动就出错呢? 是不是需要定义那些参数?  请有使用或者了解CChartCtrl的高手帮忙指导一下,非常感谢阿。

解决方案 »

  1.   

    void CChartCtrl::OnMouseMove(UINT nFlags, CPoint point) 
    {
    if (m_bRMouseDown && m_bPanEnabled)
    {
    if (point != m_PanAnchor)
    {
    EnableRefresh(false);
    if (m_pAxes[LeftAxis])
    m_pAxes[LeftAxis]->PanAxis(m_PanAnchor.y,point.y);
    if (m_pAxes[RightAxis])
    m_pAxes[RightAxis]->PanAxis(m_PanAnchor.y,point.y);
    if (m_pAxes[BottomAxis])
    m_pAxes[BottomAxis]->PanAxis(m_PanAnchor.x,point.x);
    if (m_pAxes[TopAxis])
    m_pAxes[TopAxis]->PanAxis(m_PanAnchor.x,point.x);
    RefreshCtrl();
    EnableRefresh(true);
    // Force an immediate repaint of the window, so that the mouse messages
    // are by passed (this allows for a smooth pan)
    UpdateWindow(); m_PanAnchor = point;
    }
    } if (m_bLMouseDown && m_bZoomEnabled)
    {
    m_rectZoomArea.BottomRight() = point;
    Invalidate();
    } for (int i=0; i<4; i++)
    {
    if (m_pAxes[i])
    m_pAxes[i]->m_pScrollBar->OnMouseLeave();
    }
    CWnd* pWnd = ChildWindowFromPoint(point);
    if (pWnd != this)
    {
    CChartScrollBar* pScrollBar = dynamic_cast<CChartScrollBar*>(pWnd);
    if (pScrollBar)
    pScrollBar->OnMouseEnter();
    } if (m_PlottingRect.PtInRect(point))
    {
    TCursorMap::iterator iter = m_mapCursors.begin();
    for (iter; iter!=m_mapCursors.end(); iter++)
    iter->second->OnMouseMove(point);

    Invalidate();
    } if (!m_bMouseVisible && m_PlottingRect.PtInRect(point))
    SetCursor(NULL);
    else
    SetCursor(::LoadCursor(NULL,IDC_ARROW)); SendMouseEvent(CChartMouseListener::MouseMove, point);
    CWnd::OnMouseMove(nFlags, point);
    }这是CChartCtrl中的OnMouseMove函数。
      

  2.   

    工程 - 设置 - C/C++ - 分类里选 C++语言  - 选中 允许时间类型信息(RTTI)
    确定