Having a problem figuring out the correct formula to scale between the screen and the printer:
This gives me the size of each:
screenx = _GetSystemMetrics(SM_CXSCREEN)
screeny = _GetSystemMetrics(SM_CYSCREEN)
printerx= _GetDeviceCaps(pd.hdc,HORZRES)
printery = _GetDeviceCaps(pd.hdc,VERTRES)
This determines the correct scale so the screen contents would fit on the printer page:
s1 = printerx/(screenx+0.0f)
s2 = printery/(screeny+0.0f)
IF (s1 < s2) THEN scale = s1 ELSE scale = s2
Then I apply the scaling to the rectangle I want to print:
rc2.left = 0
rc2.top = 0
rc2.right = screenx * scale
rc2.bottom = screeny * scale
Problem is that the result doesn't print correctly. If the rectangle contains a circle on the screen it prints as an elipse on the printer.
There's something missing in the scaling that accounts for aspect ratios.
I'm having a senior moment trying to figure it out. :D
Larry
I don't know much about this Larry, but I think the problem comes up from time to time .. :)
I've found a couple of references - don't know if they'll help you at all ..
http://www.ionicwind.com/forums/index.php/topic,2988.0.html
(http://www.ionicwind.com/forums/index.php/topic,2988.0.html)
http://www.ionicwind.com/forums/index.php/topic,570.0.html (http://www.ionicwind.com/forums/index.php/topic,570.0.html)
all the best, :)
Graham