PPPPP RRRRR M M AAAAA RRRRR GGGGG P P R R MM MM A A R R G PPPPP RRRRR M M M AAAAA RRRRR G GG P RRR M M A A RRR G G P R RR M M A A R RR GGGGG Functions to get the margins of the non-printable area of a printer Written for Visual Basic for Windows Copyright © 1995, Stephan Hischier ___________________________________________________________________________ Packing List : README.TXT This file PRMARG.MAK Sample VB project file PRMARG.FRM Sample VB form file PRMARG.BAS VB functions (see next paragraph) PRMARG.EXE Executable of the sample FILE_ID.DIZ Short description file ___________________________________________________________________________ Routines: 1. MarginLeft(), MarginRight(), MarginTop(), MarginBottom() Parameters : None Return value : Margin of the non-printable area Data type : Single 2. PageWidth(), PageHeight() Parameters : None Return value : Physical size of the standard paper ___________________________________________________________________________ Explanations: I had some problems to print graphics with Visual Basic 3.0 on the correct position. The problem was to find a way to get the different margins of the NON-PRINTABLE AREA of a printer. What is the NON-PRINTABLE AREA ? The NON-PRINTABLE AREA is the border around the paper on which nothing could be printed. ¦ Page Width ¦ +------------------------------+-- ¦xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx¦ ¦xx¦------------------------¦xx¦ ¦xx¦ ¦xx¦ ¦xx¦ ¦xx¦ P ¦xx¦ PRINTABLE ¦xx¦ A ¦xx¦ ¦xx¦ G ¦xx¦ ¦xx¦ E ¦xx¦ ¦xx¦ ¦xx¦ ¦xx¦ H ¦xx¦ ¦xx¦ E ¦xx¦ AREA ¦xx¦ I ¦xx¦ ¦xx¦ G ¦xx¦ ¦xx¦ H ¦xx¦ ¦xx¦ T ¦xx¦ ¦xx¦ ¦xx¦------------------------¦xx¦ ¦xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx¦ +------------------------------+-- xx = NON-PRINTABLE AREA To correctly position a text or graphic on the paper you have to know the correct values of the margins of the NON-PRINTABLE area. If you try to print a text 20mm from left and 20mm from the top (with ScaleMode = 6) on the printer, the real position is MARGINLEFT + 20mm and MARGINTOP + 20mm!! So you have to set your text to LEFT = 20mm-MARGINLEFT and TOP = 20mm-MARGINTOP. To see the margins for your printer, please use PRMARG.EXE (VBRUN300.DLL needed) or the source code PRMARG.MAK (Visual Basic needed). ___________________________________________________________________________ If you have any question or suggestions please write to Stephan Hischier COMPUSERVE-ID : 100112,670 INTERNET : 100112.670@compuserve.com or Stephan.Hischier@proline.ch If you find the functions useful, please let me know in which situation you could use them! Please feel free to use or change the functions in your applications! ___________________________________________________________________________