Private Declare Function BitBlt Lib "gdi32" (ByVal hDestDC As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As LongPrivate Sub Command2_Click() With Picture1 .AutoRedraw = True '截屏保存到Picture1 BitBlt Picture1.hdc, 0, 0, .Width / Screen.TwipsPerPixelX, .Height / Screen.TwipsPerPixelY, Me.hdc, .Left / Screen.TwipsPerPixelX, .Top / Screen.TwipsPerPixelY, vbSrcCopy '输出到打印机 Printer.PaintPicture .Image, 0, 0 Printer.EndDoc End With End Sub
PrintForm.........能看到的都能打印
PrintForm.........能看到的都能打印
[/Quote]可是只想打印picturebox里面的,它之外的就不用了啊
Private Declare Function BitBlt Lib "gdi32" (ByVal hDestDC As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As LongPrivate Sub Command2_Click()
With Picture1
.AutoRedraw = True
'截屏保存到Picture1
BitBlt Picture1.hdc, 0, 0, .Width / Screen.TwipsPerPixelX, .Height / Screen.TwipsPerPixelY, Me.hdc, .Left / Screen.TwipsPerPixelX, .Top / Screen.TwipsPerPixelY, vbSrcCopy
'输出到打印机
Printer.PaintPicture .Image, 0, 0
Printer.EndDoc
End With
End Sub