用鼠标画曲线,我想得到鼠标掠过的所有pixel的值我现在在用LButtondown()取点,但取点的数量和鼠标移动的速度有关
鼠标移动的很快时,取的点很少
请问各位大侠,怎么能取到曲线上所有的点?
用什么函数可以实现呢?

解决方案 »

  1.   

    这取决于鼠标的采样频率。
    好的鼠标,分辨率可达1000以上DPI,不同分辨率的鼠标是不同的。当你快速移动鼠标,WM_MOUSEMOVE带来的消息本来就是相对较少。其实用LineTo即可。
    SomeWindow::SomeWindow()
    {
        oldPoint.x = -1;
        oldPoint.y = -1;
    }
    void SomeWindow::OnMouseMove( POINT pt )
    {
        if( oldPoint.x != -1 || oldPoint.y != -1 )
        {
            CClientDC( this );
            dc.MoveTo( oldPoint );
            dc.LineTo( pt );
        }
        oldPoint = pt;    
    }