投稿時間:2002/09/14(Sat) 00:06 投稿者名:花ちゃん
Eメール:
URL :
タイトル:Re^3: プリンタの余白の取得
下記を試して見て下さい。
Private Declare Function GetDeviceCaps Lib "gdi32" _ (ByVal hdc As Long, ByVal nIndex As Long) As Long Private Const PHYSICALHEIGHT = 111 Private Const PHYSICALWIDTH = 110 Private Const PHYSICALOFFSETX = 112 Private Const PHYSICALOFFSETY = 113
Private Sub Command1_Click() Dim LeftMargin As Long Dim TopMargin As Long Dim PhysHeight As Long Dim PhysWidth As Long LeftMargin = (GetDeviceCaps(Printer.hdc, PHYSICALOFFSETX) _ * Printer.TwipsPerPixelX / 56.7) TopMargin = (GetDeviceCaps(Printer.hdc, PHYSICALOFFSETY) _ * Printer.TwipsPerPixelY / 56.7) PhysWidth = (GetDeviceCaps(Printer.hdc, PHYSICALWIDTH) _ * Printer.TwipsPerPixelX / 56.7) PhysHeight = (GetDeviceCaps(Printer.hdc, PHYSICALHEIGHT) _ * Printer.TwipsPerPixelY / 56.7) Label1.Caption = "プリンター用紙印刷余白(左) : " & LeftMargin & " mm" Label2.Caption = "プリンター用紙印刷余白(上) : " & TopMargin & " mm" Label3.Caption = "プリンター用紙サイズ(幅) : " & PhysWidth & " mm" Label4.Caption = "プリンター用紙サイズ(高さ) : " & PhysHeight & " mm" End Sub
|