hi guys, i just need a little help, ive created a function using the mouseclick that when a user clicks the mouse it draws a coil on the screen from that specified point. now the problem im having is that i can draw over it by clicking next to it , this is something i would like to stop, when i move the mouse over the coil i would like it to recognise that there is an object there and not be able to draw over it, and also from there i could implement a right mouse button command which would let me rotate the coil.
the question is how would i go about this im totally stuck with this part.
the code for my coil drawing is as follows.
CODE
void Ccoils2View::OnLButtonDown(Unit nFlags, CPoint point)
CView::OnLButtonDown(nFlags, point);
CDC *pDC=GETDC();
Ccoils2Doc*pDoc=GetDocument();
ASSERT_VALID(pDoc);
if (!pDoc)
return;
int angle ,z=0;
int x=0;
int y=0;
int x0=point.x;
int y0=point.y;
for (angle=0;,angle<105;angle++)
{
y=20*sin(angle*6.28/30+3.14);
x=20*cos(angle*6.28/30+3.14);
pDC->MoveTo(x+x0+angle,y+y0);
y=20*sin((angle+1)*6.28/30+3.14);
y=20*cos((angle+1)*6.28/30+3.14);
pDC->LineTo(x+x0+angle,y+y0);
}
}
im not sure if this makes much sense to you all out there,
here are the main things that im stuck on,
making the program recognise that there is an object already drawn there so that i can edit the rotation of it in the future and also not allow the program to drawn a new image over it
thanks again
dan.
This post has been edited by jjhaag: 7 Nov, 2007 - 07:46 PM