How to convert screen coordinates
I am sure I am making this more difficult than it should be but here is my problem.
I am trying to figure out how to convert the dimension of my client area from pixels to inches. I've read Petzolds book on viewports and device coordinates but I've only succeeded in freeze drying my brain!
For example lets say I want to draw a line from the left side of the client area over 2 inches like so (using MM_TWIPS map mode):
Now, lets say I want to incorporate a zoom feature in my program that will resize this line to fill the width of my client area.
LineTo (hdc, 2*1440, 250);
I know the size of the client area (in pixels) from my WM_SIZE case:
and I know that my line is 2 inches wide so If I can figure out how to convert pixels into inches or vice versa I can easily come up with a ratio to do this.
cxClient = LOWORD (lParam);
cyClient = HIWORD (lParam);
What I need is an explaination on how to do this type of conversion, because I have thoroughly confused myself!