Option ExplicitPrivate 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 Long Private Declare Function GetDC Lib "user32" (ByVal hWnd As Long) As Long Private Declare Function ReleaseDC Lib "user32" (ByVal hWnd As Long, ByVal hDC As Long) As Long Private Sub command1_Click() Dim hDC As Long, sx As Integer, sy As Integer picCopy.Visible = False picCopy.Width = Command2.Width picCopy.Height = Command2.Height
Private Declare Function GetDC Lib "user32" (ByVal hWnd As Long) As Long
Private Declare Function ReleaseDC Lib "user32" (ByVal hWnd As Long, ByVal hDC As Long) As Long
Private Sub command1_Click()
Dim hDC As Long, sx As Integer, sy As Integer picCopy.Visible = False
picCopy.Width = Command2.Width
picCopy.Height = Command2.Height
picCopy.AutoRedraw = True
hDC = GetDC(0)
sx = (Command2.Width) \ Screen.TwipsPerPixelX
sy = (Command2.Height) \ Screen.TwipsPerPixelX
BitBlt picCopy.hDC, 0, 0, sx, sy, hDC, (Me.Left + Command2.Left) \ Screen.TwipsPerPixelX, (Me.Top + Command2.Top + Me.Height - Me.ScaleHeight) \ Screen.TwipsPerPixelX, vbSrcCopy
ReleaseDC 0, hDC
picCopy.AutoRedraw = False
picCopy.Visible = True
End SubPrivate Sub Form_Load()
picCopy.Visible = False
End Sub
要打印.执行
Printer.PaintPicture picCopy.Image, 0, 0
即可.