home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / os / mswindo / programm / misc / 5340 < prev    next >
Encoding:
Text File  |  1993-01-25  |  1.6 KB  |  43 lines

  1. Newsgroups: comp.os.ms-windows.programmer.misc
  2. Path: sparky!uunet!cs.utexas.edu!qt.cs.utexas.edu!yale.edu!ira.uka.de!scsing.switch.ch!rzusuntk.unizh.ch!hagger
  3. From: hagger@rsl.geogr.unizh.ch (Joachim Hagger)
  4. Subject: SUMMARY: Width of print border
  5. Message-ID: <1993Jan25.135214.14380@rzu-news.unizh.ch>
  6. Sender: root@rzu-news.unizh.ch (Operator)
  7. Organization: Remote Sensing Laboratories, University of Zurich
  8. Date: Mon, 25 Jan 1993 13:52:14 GMT
  9. Lines: 32
  10.  
  11.  
  12. The original question was:
  13. > How can I determine the non-printing border offset added to my documents?
  14.  
  15. The only answer I got was the right solution:
  16. twbrown@PE-Nelson.COM (Tom W. Brown) answered:
  17.  
  18. The following function will give you the pixel offset from the top left
  19. corner of the page for the first printable pixel (i.e. the pixel based
  20. size of the left and top border):
  21.  
  22.    POINT ptOffset;
  23.    Escape(hdc, GETPRINTINGOFFSET, NULL, NULL, &ptOffset);
  24.  
  25. Now, the next call(s) will give you the printable area ot the page in pixels:
  26.  
  27.    POINT ptPrintable;
  28.    ptPrintable.x = GetDeviceCaps(hdc, HORZRES);
  29.    ptPrintable.y = GetDeviceCaps(hdc, VERTRES);
  30.  
  31. And finally, this function gives you the total, physical page size (still
  32. in pixels);
  33.  
  34.    POINT ptPhysical;
  35.    Escape(hdc, GETPHYSICALPAGESIZE, NULL, NULL, &ptPhysical);
  36.  
  37. So, ptOffset gives you the left and top border directly. The right and
  38. bottom borders can be found by simply subtracting the corresponding left
  39. and top border along with the printable width and height from the
  40. physical width and height of the page.
  41.  
  42. All unit are in pixels -- you can convert to whatever units you need.
  43.