VB4 にて余白を取得する.
Width, Height や ScaleWidth や ScaleHeight 等で用紙の大きさや出力可能範囲は判別可能である.
余白がどれだけあるかは GetDeviceCaps() を使用する.
Global Const HORZRES = 8
Global Const VERTRES = 10
Global Const PHYSICALOFFSETX = 112
Global Const PHYSICALOFFSETY = 113
Declare Function GetDeviceCaps Lib "gdi32" (ByVal hdc As Long, ByVal nIndex As Long) As Long
PrPicWidth = GetDeviceCaps( Printer.hDC, HORZRES) * Printer.TwipsPerPixelX
PrPicHeight = GetDeviceCaps( Printer.hDC, VERTRES) * Printer.TwipsPerPixelY
PrPicLeft = GetDeviceCaps( Printer.hDC, PHYSICALOFFSETX) * Printer.TwipsPerPixelX
PrPicRight = Printer.Width - PrPicLeft - PrPicWidth
PrPicTop = GetDeviceCaps( Printer.hDC, PHYSICALOFFSETY) * Printer.TwipsPerPixelY
PrPicBottom = Printer.Height - PrPicTop - PrPicHeight
PrPicWidth : 印刷可能領域の幅 (twip単位)
PrPicHeight : 印刷可能領域の高さ( 〃 )
PrPicLeft : 左端の余白の大きさ( 〃 )
PrPicRight : 右端の余白の大きさ( 〃 )
PrPicTop : 上端の余白の大きさ( 〃 )
PrPicBottom : 下端の余白の大きさ( 〃 )
参照
プリンタ印字可能範囲