CDC::Ellipse()

• 12-15-2008
manzoor
CDC::Ellipse()
I want to use the ellipse function to create circles...... so for that I need to get its bounding rectangles...

How to get that?

The user will click on the client area and I'm gonna note that point and then he'll drag it to create the circle and finally he may release the mouse button and that point will be somewhere on the circumference of the circle and I'll note that too.. Now how to find its bounding rectangle ??

I'm bad at maths/geometry so please help me out tell me what do i need to learn in order to understand this or tell me how to calculate them... ty
• 12-15-2008
Codeplug
Just use the rectangle created by the two points. Use a couple of "if" statements to determine if the 2 points are upper-left and lower-right, or lower-left and upper-right.

gg
• 12-15-2008
BobS0327
Quote:

Originally Posted by manzoor
I want to use the ellipse function to create circles...... so for that I need to get its bounding rectangles...

How to get that?

The user will click on the client area and I'm gonna note that point and then he'll drag it to create the circle and finally he may release the mouse button and that point will be somewhere on the circumference of the circle and I'll note that too.. Now how to find its bounding rectangle ??

I'm bad at maths/geometry so please help me out tell me what do i need to learn in order to understand this or tell me how to calculate them... ty

Looks as though CDC::Ellipse uses starting and ending points which are determined by the mouse clicks. In other words, when the user initially clicks on the client area, x1 would be the initial x position of the mouse pointer and y1 would be the initial y position of the mouse pointer. When the user finally moves the mouse to the destination point and releases the mouse button, x2 will be the destination x position of the mouse pointer and y2 will be the y position of the mouse pointer. So, just save your starting and endxing x,y positions for input to Ellipse.