' 我课件中的一个代码 Private Sub num_print_Click() On Error GoTo 300 Dim w As Long, h As Long Dim px As Long, py As Long Picture1.AutoRedraw = True Set Picture1.Picture = Picture1.Image Picture1.ScaleMode = vbTwips Printer.ScaleMode = vbTwips w = Picture1.Width * N \ 100 h = Picture1.Height * N \ 100 If pos = 0 Then px = 0: py = 0 Else px = (Picture1.ScaleWidth - w) / 2 ' 打印在中间 py = (Picture1.ScaleHeight - h) / 2 End If ' 打印Picture1里面的图形 Printer.PaintPicture Picture1.Picture, px, py, w, h Printer.EndDoc Picture1.AutoRedraw = False 300 End Sub
可是,PrintForm方法没有参数啊
这个可能对你有用Dim X As Printer For Each X In Printers If X.Orientation = vbPRORPortrait Then '设定为系统缺省打印机。 Set Printer = X ' 终止查找打印机。 Exit For End If Next
Set mPrinter = Printers(0)?
Private Sub num_print_Click()
On Error GoTo 300
Dim w As Long, h As Long
Dim px As Long, py As Long
Picture1.AutoRedraw = True
Set Picture1.Picture = Picture1.Image Picture1.ScaleMode = vbTwips
Printer.ScaleMode = vbTwips w = Picture1.Width * N \ 100
h = Picture1.Height * N \ 100 If pos = 0 Then
px = 0: py = 0
Else
px = (Picture1.ScaleWidth - w) / 2 ' 打印在中间
py = (Picture1.ScaleHeight - h) / 2
End If
' 打印Picture1里面的图形
Printer.PaintPicture Picture1.Picture, px, py, w, h
Printer.EndDoc
Picture1.AutoRedraw = False
300
End Sub
For Each X In Printers
If X.Orientation = vbPRORPortrait Then
'设定为系统缺省打印机。
Set Printer = X
' 终止查找打印机。
Exit For
End If
Next