INFO: Limit of Logical Coordinate System in Windows (39802)



The information in this article applies to:

  • Microsoft Windows Software Development Kit (SDK) 3.1

This article was previously published under Q39802
3.00 WINDOWS kbprg

SUMMARY

The limits of the logical coordinate system are from -32768 to +32767. An item can be drawn anywhere within this coordinate system; however, the window extent cannot be set to greater than 32767. (Although this might seem to limit the system to the -16384 to 16383 range, this is not the case.) If the viewport and window are set up properly, everything will be shown. For example, to set up the whole logical coordinate system to be shown within the application's area of the screen, the following code works properly:
   /*  Establish viewport to be upper-left quarter of client area */ 

   GetClientRect(hWnd, (LPRECT) &CRect);
   SetViewportOrg(hDC, 0, 0);
   SetViewportExt(hDC, (CRect.right - CRect.left) / 2, \ 

                      (CRect.bottom - CRect.top) / 2);

   /*  Set Window Origin and Extent such that total logical */ 
   /*     coordinate system will cover entire client area   */ 

   SetWindowOrg(hDC, -32767, -32767);
   SetWindowExt(hDC, 32767, 32767);
				

Modification Type:MinorLast Reviewed:3/21/2005
Keywords:kb16bitonly kbinfo KB39802