Rectangle Co-ordinates.

Joined
Jun 23, 2006
Messages
14
Programming Experience
1-3
Drawing Circle.

Hi,
I am allowing users in my application to draw an elipse by dragging with the mouse. My code is below. The problems are:
1. I want them only to be able to draw a circle(this is for a tool to create HTML imagemaps)
2. I want to get that circle's centre point and radius when I am done.
If anyone knows how to do either of these things please help. I have had no success so far.
 
Last edited:
1. on mouse down, store the position of the cursor to a global point A.
2. on mouse move, store the position of the cursor to a global point C.
3. on mouse up, set C to -1,-1, and store current location to B

4. on paint, if C =-1,-1 draw a rectangle from point A to point C
5. on paint, if C <> -1,-1 draw the rectangle from point A to B

easily expanded to use an array of rectangles to draw more than one.
 
Back
Top