|
-
Jun 7th, 2003, 10:14 PM
#1
New Member
There is a solution without having to resort to dll's. I am not sure which imaging package you are using, but if yours is like mine, it requires a render method with a printer.hdc.
Took me a little while to figure it out, but it works pretty well.
First, drag a printdocument from the Windows Forms toolbox to your form.
Add the following code to handle the print page:
Private Sub PrintDocument1_PrintPage(ByVal sender As Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage
Dim printerhdc As IntPtr = e.Graphics.GetHdc()
' Do whatever you need to do to get the right image
XYZ.Load file(currentpagenumber)
XYZ.Render(printerhdc.ToInt64, 25, 25, Width, Height)
CurrentPageNumber += 1
If CurrentPageNumber < TotalPageCount Then
e.HasMorePages = True
Else
e.HasMorePages = False
End If
e.Graphics.ReleaseHdc(printerhdc)
End Sub
Then do the following:
'Gather all the files you need and put their names in an arraylist.
'Then issue the print command
PrintDocument1.Print
' You've just printed your files
Beats having to make a VB6.dll.
BTW, if you look at the available properties and methods for e.Graphics, you won't see the GetHDC and ReleaseHDC. They are, however, somewhat documented in MSDN.
Last edited by esskay; Jun 7th, 2003 at 10:17 PM.
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
|