|
-
Feb 3rd, 2004, 07:23 AM
#1
Thread Starter
New Member
Printing Problema...
Is there anyway of printing a Form that is bigger than the screen (A4 size) using the PrintForm Method?
I'm having a problem with an application that i created. People are complaining that sometimes the form isn't totally printed, only 2/3 appears...
What is strange is that most of the times the print goes well, but there are times where it goes wrong and if we insist it eventually goes well...
Particulary in my system i dont remeber see this kind of bad behaviour...
For me it only can be one of 2 things:
- the fact that the Form height exceeds the screen size ;
- or that is a limitation in PrintForm method when printing to a remote shared Printer (HP 840C in this case).
can someone help me???
Do i have to forget PrintForm method and start using Printer object ? I have to many controls in the form but if i have to do it...
-
Feb 3rd, 2004, 12:46 PM
#2
Try this
VB Code:
Option Explicit
'Prntform sample from BlackBeltVB.com
' [url]http://blackbeltvb.com[/url]
Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
Private Const VK_MENU As Byte = &H12
Private Const VK_SNAPSHOT As Byte = &H2C
Private Const KEYEVENTF_KEYUP = &H2
Private Sub Command1_Click()
Dim lWidth As Long
Dim lHeight As Long
Clipboard.Clear
Call keybd_event(VK_MENU, 0, 0, 0)
Call keybd_event(VK_SNAPSHOT, 0, 0, 0)
DoEvents
Call keybd_event(VK_SNAPSHOT, 0, KEYEVENTF_KEYUP, 0)
Call keybd_event(VK_MENU, 0, KEYEVENTF_KEYUP, 0)
Printer.Print
If Width > Printer.ScaleWidth Then
lWidth = Printer.ScaleWidth
lHeight = (Printer.ScaleWidth / Width) * Height
Else
lWidth = Width
lHeight = Height
End If
Printer.PaintPicture Clipboard.GetData, 0, 0, lWidth, lHeight
Printer.EndDoc
End Sub
-
Feb 3rd, 2004, 04:12 PM
#3
Also, be sure you have the latest service packs. I remember being pretty frustrated printing in VB. I finally tracked one of the problems down to a bug in the compiler. Microsoft acknowledged that it was a bug, directed me to a service pack, and a couple of other bugs that I hadn't examined went away at the same time.
-
Feb 5th, 2004, 04:43 AM
#4
Thread Starter
New Member
MartinLiss
unfortunelly i didn't got time yet to try your code but i will do it But tell me one thing what the code does is a "snapshot" of the screen isn't it? that won't do for me because in my application is possible that i may have to print more than 1A4 sheet. This because i have a listbox with several information on it, and when the listbox is to big that doesn't fit on 1sheet i have to use another template hidden form to print the 2nd,3rd,...,nth sheet.
at the moment i'm using 2templates hidden forms, the second is used when the first can't hold by itself all the information. This is working quit well in my system but as i told you, in other systems the print doesn't go well all the times.
Is that because the form exceeds the screen size?
-
Feb 5th, 2004, 04:46 AM
#5
Thread Starter
New Member
Shaggy Hiker
hi! have you ever had problems like the one i mentioned? sometimes the printing goes well another time goes bad? and in your case service packs was the solution?
tkx
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
|