让他响应滚轮消息,如何?

解决方案 »

  1.   

    由于我在CFormView下用MSFlexGrid控件,所以我在CFormView里的滚轮消息函数里添加如下代码:BOOL CMyFormView::OnMouseWheel(UINT nFlags, short zDelta, CPoint pt) 
    {
    // TODO: Add your message handler code here and/or call default
    int nPos = m_gridMyForm.GetScrollPos(SB_VERT);
    int nMax = m_gridMyForm.GetScrollLimit(SB_VERT); if(zDelta < 0)
    {
    nPos += 3;
    (nPos >= nMax) ? (nPos = nMax-1) : NULL;
    }
    else
    {
    nPos -= 3;
    (nPos <= 1) ? (nPos = 1) : NULL;
    }
    m_gridMyForm.SetTopRow(nPos);
    return CPFormView::OnMouseWheel(nFlags, zDelta, pt);
    }