VB-Tec.de Visual Basic - Technik, FAQ, Tricks, BeispieleHome / System / Drucker / Rand Physikalische Druckerränder |
GetDeviceCaps können bei 32-Bit Systemen (Windows95 / 98 u. Windows NT / 2000) die physikalischen Druckerränder ermittelt werden:'Im Deklarationsteil:
Private Const PHYSICALOFFSETX As Long = 112
Private Const PHYSICALOFFSETY As Long = 113
Private Declare Function GetDeviceCaps Lib "GDI32" ( _
ByVal hDC As Long, ByVal nIndex As Long) As Long
'Im Programmteil:
With Printer
LRand = .ScaleX(GetDeviceCaps(.hDC, PHYSICALOFFSETX), vbPixels)
ORand = .ScaleY(GetDeviceCaps(.hDC, PHYSICALOFFSETY), vbPixels)
RRand = .ScaleX(.Width, vbTwips) - .ScaleWidth - LRand
URand = .ScaleY(.Height, vbTwips) - .ScaleHeight - ORand
End With
Man beachte, dass Printer.ScaleMode die Einheit der Rückgabewerte bestimmt. Sollen z.B. alle Angaben in Millimeter erfolgen, so muss vorher einfach folgende Zeile stehen:Printer.ScaleMode = vbMillimeters
© Jost Schwider, 30.04.2000-05.05.2000 - http://vb-tec.de/drckrand.htm