×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Can I print more than I can see on a form?

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-

RE: Can I print more than I can see on a form?

Maybe this will do the job:
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?

(OP)
Many thanks for the solution.  A minor tweak to account for if no image was present in the image box and this worked a treat!

RE: Can I print more than I can see on a form?

Try using the PrintForm Method.
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?

You are Wright Jonathan, but there is big difference in printing quality.Only printing pictures are the same quality.

RE: Can I print more than I can see on a form?

(OP)
  Thank you for the suggestions, however using the printform method will only print the contents of the from that is currently visible.
  My problem was that I wanted to print controls that were off the edge of a form.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members! Already a Member? Login


Resources

Low-Volume Rapid Injection Molding With 3D Printed Molds
Learn methods and guidelines for using stereolithography (SLA) 3D printed molds in the injection molding process to lower costs and lead time. Discover how this hybrid manufacturing process enables on-demand mold fabrication to quickly produce small batches of thermoplastic parts. Download Now
Design for Additive Manufacturing (DfAM)
Examine how the principles of DfAM upend many of the long-standing rules around manufacturability - allowing engineers and designers to place a part’s function at the center of their design considerations. Download Now
Taking Control of Engineering Documents
This ebook covers tips for creating and managing workflows, security best practices and protection of intellectual property, Cloud vs. on-premise software solutions, CAD file management, compliance, and more. Download Now

Close Box

Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close