Private Declare Function StartDoc Lib "gdi32" Alias "StartDocA" (ByVal hdc As Long, lpdi As DOCINFO) As Long
Private Declare Function StartPage Lib "gdi32" (ByVal hdc As Long) As Long
Private Declare Function EndPage Lib "gdi32" (ByVal hdc As Long) As Long
Private Declare Function EndDoc Lib "gdi32" (ByVal hdc As Long) As Long
Private Type DOCINFO
cbSize As Long
lpszDocName As String
lpszOutput As String
End Type
Private Declare Function Rectangle Lib "gdi32" (ByVal hdc As Long, ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
Private Sub Command1_Click()
Printer.Line (100, 100)-(1000, 1500), RGB(0, 0, 0), B
Printer.EndDoc
End SubPrivate Sub Command2_Click()
Dim DI As DOCINFO
DI.cbSize = Len(DI)
DI.lpszDocName = "绘制矩形"
StartDoc Printer.hdc, DI
StartPage Printer.hdc
Rectangle Printer.hdc, 100 / Screen.TwipsPerPixelX, 100 / Screen.TwipsPerPixelY, 1000 / Screen.TwipsPerPixelX, 1500 / Screen.TwipsPerPixelY
EndPage Printer.hdc
EndDoc Printer.hdc
End Sub
=========================
大家帮助我运行下,为什么相同的尺寸,打印出来却不一样呢?
Private Declare Function StartPage Lib "gdi32" (ByVal hdc As Long) As Long
Private Declare Function EndPage Lib "gdi32" (ByVal hdc As Long) As Long
Private Declare Function EndDoc Lib "gdi32" (ByVal hdc As Long) As Long
Private Type DOCINFO
cbSize As Long
lpszDocName As String
lpszOutput As String
End Type
Private Declare Function Rectangle Lib "gdi32" (ByVal hdc As Long, ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
Private Sub Command1_Click()
Printer.Line (100, 100)-(1000, 1500), RGB(0, 0, 0), B
Printer.EndDoc
End SubPrivate Sub Command2_Click()
Dim DI As DOCINFO
DI.cbSize = Len(DI)
DI.lpszDocName = "绘制矩形"
StartDoc Printer.hdc, DI
StartPage Printer.hdc
Rectangle Printer.hdc, 100 / Screen.TwipsPerPixelX, 100 / Screen.TwipsPerPixelY, 1000 / Screen.TwipsPerPixelX, 1500 / Screen.TwipsPerPixelY
EndPage Printer.hdc
EndDoc Printer.hdc
End Sub
=========================
大家帮助我运行下,为什么相同的尺寸,打印出来却不一样呢?
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货