如何画一组点,使移动到其中一点时该点变颜色,而且拖动该点可以移动??

解决方案 »

  1.   

    设置一个数组,存下所有点!为每一个点设置相应区域,加入 (i,j)
    rect.top = j-3;
    rect.left = i-3;
    rect.right = i+3;
    rect.bottom = j+3;
    这样,在OnMouseMove中判断,当鼠标移到这个区域
    点变色!!用PtInRect();;
    点击鼠标,之后,设定拖动标志,
    也就是可以改动选定点的值,
    然后重新画图象!具体的代码,不用写了吧!!
      

  2.   

    CRect::PtInRect 
    BOOL PtInRect( POINT point ) const;Return ValueNonzero if the point lies within CRect; otherwise 0.ParameterspointContains a POINT structure or CPoint object.ResDetermines whether the specified point lies within CRect. A point is within CRect if it lies on the left or top side or is within all four sides. A point on the right or bottom side is outside CRect.Note   The rectangle must be normalized or this function may fail. You can call NormalizeRect to normalize the rectangle before calling this function.
      

  3.   

    不用遍历所有区域!
    只需要调用
    各个rect就可以了!判断鼠标当前在哪个区域里就行了!
    你可以建立一个CRect数组!
      

  4.   

    可以,你现在在么?
    不是拖动点的,是拖动线的!
    [email protected]