CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2013
    Posts
    1

    CDC::Ellipse doesn't work properly

    Hi everybody,

    in a project of mine (VC++2010, MFC), I want to draw a circle using the CDC::Ellipse.

    Wheh I draw a circle with CDC::Ellipse, I have noticed that the figure is not exactly a circle because it has not a constant radius. At 0° (periodicity = 45°) the radius has the value I want it to be, at 22.5° (periodicity = 45°) the radius has a value slightly bigger then the value I want it to be. It is a weird behavior that I can't explain. When I draw the same shape "manually", i.e. with a polyline, the figure is exactly a circle with the same value of radius at any point on the circumference.

    Can anyone help me?

    Thanks.

  2. #2
    Join Date
    Apr 2000
    Location
    Belgium (Europe)
    Posts
    4,626

    Re: CDC::Ellipse doesn't work properly

    Do you want a circle according to pixels
    or do you want a circle according to visible screen measurement ?

    THe core issue here:
    The aspect ratio of the assumed pixels the ellipse is being drawn at doesn't match the aspect ratio you are expecting.


    CDC::Ellipse works with mapping mode coordinates. (by default this is pixel coordinates)
    See CDC::GetAspectRatioFilter()
    If that isn't helping you to correct, your display device may not be properly reporting to windows what it's aspect ratio is, you'll need manual intervention to adjust the coordinates in that case.

  3. #3
    Join Date
    Aug 2000
    Location
    New York, NY, USA
    Posts
    5,656

    Re: CDC::Ellipse doesn't work properly

    Quote Originally Posted by MA7730 View Post
    When I draw the same shape "manually", i.e. with a polyline, the figure is exactly a circle ...
    How could polyline be *EXACTLY* a circle?
    Anyway, could you please post screenshot to illustrate the issue?
    Vlad - MS MVP [2007 - 2012] - www.FeinSoftware.com
    Convenience and productivity tools for Microsoft Visual Studio:
    FeinWindows - replacement windows manager for Visual Studio, and more...

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured