1、在自绘CTreeCtrl 的滚动条时候处理OnMouseMove(UINT nFlags, CPoint point)出问题,就是滚动条不动,老是弹回原处。
2、隐藏不掉树本身的滚动条3、附件为demo
请高手帮忙,谢谢!

解决方案 »

  1.   

    树本身的滑动条隐藏的属性选上了吗?
    老是弹回原处的问题,应该是你没有设置它的位置吧,用这个试一下SetScrollInfo。例:
         scrollinfo.nPos = nPos;    
        SetScrollInfo(SB_VERT,&scrollinfo,SIF_ALL);
      

  2.   

    void CSkinVerticleScrollbar::OnMouseMove(UINT nFlags, CPoint point) 
    {
    CRect clientRect;
    GetClientRect(&clientRect); if(bMouseDown)
    {
    nThumbTop = point.y-13; //-13 so mouse is in middle of thumb

    double nMax = pTree->GetScrollLimit(SB_VERT);
    int nPos = pTree->GetScrollPos(SB_VERT); double nHeight = clientRect.Height()-98;
    double nVar = nMax;
    dbThumbInterval = nHeight/nVar; //figure out how many times to scroll total from top
    //then minus the current position from it
    int nScrollTimes = (int)((nThumbTop-36)/dbThumbInterval)-nPos; //grab the row height dynamically
    //so if the font size or type changes
    //our scroll will still work properly
    // CRect itemrect;
    // pTree->GetItemRect(0,&itemrect, LVIR_BOUNDS); // CSize size;
    // size.cx = 0;
    // size.cy = nScrollTimes*itemrect.Height();

    // pTree->SetScrollTime(nScrollTimes); LimitThumbPosition(); Draw();

    }
    CStatic::OnMouseMove(nFlags, point);
    }这是代码,int nPos = pTree->GetScrollPos(SB_VERT);总是得到零,设置pTree->SetScrollPos()也就没意义了!
    帮忙!先谢谢了!
      

  3.   

    pTree-> GetScrollPos(SB_VERT),总是得到零
    ========================
    你这样得到的值应该是pTree原来的滑动条的值,你并不是移动的它,因此它的值总是零,改变你现在重绘的滑动块的值应该不是在这里。在你的重绘代码里应该是