Thread: CDC::Ellipse()

  1. #1
    Registered User
    Join Date
    Nov 2007
    Posts
    164

    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

  2. #2
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,981
    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

  3. #3
    Registered User
    Join Date
    Mar 2005
    Location
    Mountaintop, Pa
    Posts
    1,058
    Quote Originally Posted by manzoor View Post
    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.

Popular pages Recent additions subscribe to a feed