# Re: 有关萤幕列印问题??

Posted by 洪扬 on November 26, 1998 at 22:06:12:

In Reply to: Re: 有关萤幕列印问题?? posted by 土狗 on November 25, 1998 at 11:39:05:

: 用printscreen 的方法我知道
: 我是想用类似 hot key 的方式来将萤幕的画面印到印表机

建一个FORM,再放一个COMMAND BUTTOM,再放一个PICTUREBOX, 程式码如下:
Private Declare Sub keybd_event Lib "user32" _
(ByVal bVk As Byte, ByVal bScan As Byte, _
ByVal dwFlags As Long, _
ByVal dwExtraInfo As Long)
Const TheScreen = 1 '印萤幕用这个参数
Const TheForm = 0 '印FORM用这个参数

Private Sub Command1_Click()
Call keybd_event(vbKeySnapshot, TheForm, 0, 0)
Picture1.Picture = Nothing
Picture1.Picture = Clipboard.GetData(vbCFBitmap)
Printer.PaintPicture Picture1.Picture, 0, 0
Printer.EndDoc
End Sub

Follow Ups: