Can I print more than I can see on a form?
Can I print more than I can see on a form?
(OP)
Is it possible to print the entire contents of a form including that which cannot be seen (because it is off to one side, not because it's invisible)?
If not, is it possible to print a picture box and it's contents including those that do not fit on the form?
Any help/advice would be greatly appreciated as I need to do this for part of my A-Level project.
-Az43-
If not, is it possible to print a picture box and it's contents including those that do not fit on the form?
Any help/advice would be greatly appreciated as I need to do this for part of my A-Level project.
-Az43-
RE: Can I print more than I can see on a form?
Put this code in Form module witch Form you want to print!
Private Sub Command1_Click()
'dim ......... put here declarations ......
'********************** Printing a limit box (only for probe)****************
Printer.ScaleMode = vbCentimeters
Printer.Orientation = 2 ' or 1
HorizontalMargin = (29.7 - Printer.ScaleWidth) / 2
VerticalMargin = (21 - Printer.ScaleHeight) / 2
HorizontalMargin = HorizontalMargin ' in my case!!!!!
VerticalMargin = 1 + VerticalMargin ' never mind
Printer.Print "";
Printer.Line (HorizontalMargin, VerticalMargin)-(29.7 - HorizontalMargin - 1, 21 - VerticalMargin), RGB(0, 0, 0), B
'*************************************************
Printer.ScaleMode = 1
Dim c As Control 'use c as the generic control object
For Each c In Controls
If TypeOf c Is Label Then ' for all labels
Printer.FontName = c.FontName
Printer.FontSize = c.FontSize
Printer.FontBold = c.FontBold
Printer.FontItalic = c.FontItalic
Printer.FontUnderline = c.FontUnderline
Printer.FontStrikethru = c.FontStrikethru
Printer.ForeColor = c.ForeColor
Printer.CurrentX = c.Left
Printer.CurrentY = c.Top
Printer.Print c.Caption;
End If
If TypeOf c Is TextBox Then 'for all textboxes
Printer.FontName = c.FontName
Printer.FontSize = c.FontSize
Printer.FontBold = c.FontBold
Printer.FontItalic = c.FontItalic
Printer.FontUnderline = c.FontUnderline
Printer.FontStrikethru = c.FontStrikethru
Printer.ForeColor = c.ForeColor
Printer.CurrentX = c.Left
Printer.CurrentY = c.Top
Printer.Print c.Text;
End If
If TypeOf c Is PictureBox Then 'for all PictureBoxes
Printer.CurrentX = c.Left
Printer.CurrentY = c.Top
c.AutoSize = True
c.Refresh
c.AutoSize = False
Printer.PaintPicture c.Picture, c.Left, c.Top
End If
If TypeOf c Is Image Then 'for all Images
Printer.CurrentX = c.Left
Printer.CurrentY = c.Top
Printer.PaintPicture c.Picture, c.Left, c.Top
End If
If TypeOf c Is Line Then 'for all lines
'make requisted lines properties equal with Printer object properties.......
Printer.Line (c.X1, c.Y1)-(c.X2, c.Y2)
End If
' And so on:
'first put "if TypeOf c Is AnyControl Then"
'then make the properties of AnyControl equal with Printer object properties
'and print. ....
Next c
Printer.EndDoc
End Sub
RE: Can I print more than I can see on a form?
RE: Can I print more than I can see on a form?
The syntax is as follows:
[form.]PrintForm
If you omit the form name, Visual Basic prints the current form. PrintForm prints the entire form, even if part of the form is not visible on the screen. If a form contains graphics, however, the graphics print only if the form’s AutoRedraw property is set to True. When printing is complete, PrintForm calls the EndDoc method to clear the printer.
RE: Can I print more than I can see on a form?
RE: Can I print more than I can see on a form?
My problem was that I wanted to print controls that were off the edge of a form.