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.
rect.top = j-3;
rect.left = i-3;
rect.right = i+3;
rect.bottom = j+3;
这样,在OnMouseMove中判断,当鼠标移到这个区域
点变色!!用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.
只需要调用
各个rect就可以了!判断鼠标当前在哪个区域里就行了!
你可以建立一个CRect数组!
不是拖动点的,是拖动线的!
[email protected]