I'm trying to display some fairly simple 2-d drawings in part of a dialog box, using VC++6. They're schematics of objects (different from instance to instance of the dialog) but always about 60 to 120 mm wide, and somewhere around 50 to 100 mm high.
I'd *really* like it to display at exactly the same size it really is, but am not having conspicuous success.
I first tried setting mapping mode to MM_HIMETRIC, and multiplying all the dimensions of the object by 100. But, for instance, a circle 70 mm in diameter comes out anywhere from 80 to 90 mm on the display. The actual displayed size changes when I change my screen resolution.
The next thing I tried was to use GetDeviceCaps to find out the width in mm of the display, height in mm; width in pixels, height in lines... then did some math and mapping mode MM_ANISOTROPIC, thusly:
//(m_Canvas, here is the area in which I'm drawing):
int icx = m_Canvas.left+(m_Canvas.right-m_Canvas.left)/2;
int icy = m_Canvas.top+(m_Canvas.bottom-m_Canvas.top)/2;
int iScreenWidthMM = dc.GetDeviceCaps(HORZSIZE);
int iScreenHeightMM = dc.GetDeviceCaps(VERTSIZE);
int iScreenWidthPixels = dc.GetDeviceCaps(HORZRES);
int iScreenHeightPixels = dc.GetDeviceCaps(VERTRES);
dc.SetWindowExt(iScreenWidthMM * 100,
-iScreenHeightMM * 100);
...the sizing is coming out exactly the same as when I was using MM_HIMETRIC.
I'm a newbe to both VC++ and the Windows graphics API (as is most likely obvious). If anyone would be so kind as to point me at a resource for this, I'd be most appreciative! I've looked at many Internet sites, and have 3 or 4 "Beginning Visual C++" books by various authors, and none of them address this particular point.