|
-
Nov 3rd, 1999, 10:20 PM
#4
The following code should work. It uses an invisible picturebox called Picture1 and the code to print the form is in the Click event of Command1:
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 Long
Private Const SRCCOPY = &HCC0020
Private Sub Command1_Click()
BitBlt Picture1.hDC, 0, 0, _
Picture1.Width / Screen.TwipsPerPixelX, _
Picture1.Height / Screen.TwipsPerPixelY, _
Me.hDC, 0, 0, SRCCOPY
Printer.PaintPicture Picture1.Image, 0, 0
Printer.EndDoc
End Sub
Private Sub Form_Load()
'
'you can set these properties a design time
'
With Picture1
.Visible = False
.AutoRedraw = True
.BorderStyle = vbBSNone
End With
End Sub
Private Sub Form_Resize()
With Picture1
.Width = Me.ScaleWidth
.Height = Me.ScaleHeight
End With
End Sub
Good luck!
------------------
Joacim Andersson
[email protected]
[email protected]
www.YellowBlazer.com
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|