Re: Plotting points



That's code I posted. I assume that the reader has the sense to realize that the variable
has to be declared as a variable of type HCURSOR, and a LoadCursor will be used to
initialize it.
joe

On Sat, 04 Feb 2006 14:44:18 GMT, "Ed" <eddie@xxxxxxxxxx> wrote:

In the code that I received from someone here "dragcursor" comes up
"Undeclared Identifier" what should it be.

#define DELTA 4
CSize offset;
int dragger;


dc.Polyline(Points, PointCount);

void CMyWnd::OnLButtonDown(UINT flags, CPoint pt)
{
CRect box(pt.x - DELTA, pt.y - DELTA, pt.x + DELTA, pt.y + DELTA);
for(int i = 1; i < PointCount - 1; i++)
{ /* scan */
if(box.PtInRect(Points[i]))
{ /* hit */
SetCursor(dragcursor); // ******** the problem is here ********
SetCapture();
dragger = i;
offset = CSize(pt.x - Points[i].x, pt.y - Points[i].y);
// check my logic on the sign of the offset...
} /* hit */
} /* scan */
}

void CMyWnd::OnMouseMove(UINT flags, CPoint pt)
{
if(GetCapture() != NULL)
{ /* has capture */
Points[dragger].y = pt.y - offset.cy; // check my sign logic here...
Invalidate(); // could make this smarter, exercise for reader
} /* has capture */
}

void CMyWnd::OnLButtonUp(UINT flags, CPoint pt)
{
if(GetCapture() != NULL)
ReleaseCapture();
}

Joseph M. Newcomer [MVP]
email: newcomer@xxxxxxxxxxxx
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
.