Simple (?) graphics question

G

Geoff Pennington

I've never done any graphics before and am experimenting. I tried to draw a
circle using the graphics.DrawEllipse() method, something like this:
DrawEllipse(myPen, 0,0,300,300). However, the "circle" came out a little
stretched, as if I had given it parameters for a rectangle instead of a
square.

I know this has something to do with the screen resolution; when I changed
the resolution using the Control Panel | Display settings, the amount of
distortion changed. I thought I could use the DpiX and DpiY properties to
tell me how to adjust, but they both showed "96". If I understand those
properties correctly, it seems there should be no distortion, since they are
equal.

Can someone tell me how to make my circles circular and avoid the stretching
effect?

Much obliged.
 
G

Geoff Pennington

Found a solution, in case anyone wants to know how this turned out. The
video height and width settings, in pixels, are buried somewhere in the
"system" namespace (can't remember where, off the top of my head, and my
code is not at hand.) The video width / height ratio should match the
physical width / height ratio. If they don't match, you get distortion.

You determine physical dimensions with a tape measure. Fortunately there are
only a few standard screen sizes out there.

There are three ways to eliminate the distortion.
1. Go to the Control Panel and change the display settings to something that
matches your physical screen.
2. Determine the physical width and height. Determine the video width and
height settings. Use them to determine a correction constant. Multiple your
X or Y coordinate (depending on how you calculated the constant) by the
constant.
3. Determine a constant by giving the user a slider control and redrawing
some figure. When the user likes the proportions of the figure determine a
correction constant from the slider setting.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top