OnMouseWheel的通常处理

BOOL CMainWindow::OnMouseWheel(UINT nFlags,
                              short zDelta,
                              CPoint point)
{
     BOOL bUp = TRUE;
     int nDelta = zDelta;
     if(zDelta < 0) {
         bUp = FALSE;
         nDelta = -nDelta;
     }
     UINT nWheelScrollLines;
     ::SystemParametersInfo(SPI_GETWHEELSCROLLLINES, 0,
         &nWheelScrollLines, 0);
     int nLines = (nDelta * nWheelScrollLines) / WHEEL_DELTA;
     while(nLines--)
         SendMessage(WM_VSCROLL, MAKEWPARAM(bUp ? SB_LINEUP : SB_LINEDOWN, 0), 0);
     return TRUE;
}
 

 

posted @ 2015-05-19 10:54  迷茫的菜鸟  阅读(679)  评论(0编辑  收藏  举报