How to: Print the Client Area of a Form (Visual Basic)
The PrintForm component enables you to quickly print an image of a form without using a PrintDocument component. The following procedure shows how to print just the client area of a form, without the title bar, borders, and scroll bars.
To print the client area of a form
-
In the Toolbox, click the Visual Basic PowerPacks tab and then drag the PrintForm component onto the form.
The PrintForm component is added to the component tray.
-
In the Properties window, set the PrintAction property to PrintToPrinter.
-
Add the following code in the appropriate event handler (for example, in the Click event handler for a Print Button).
PrintForm1.Print(Me, PowerPacks.Printing.PrintForm.PrintOption.ClientAreaOnly)
NoteOn some operating systems, text or graphics drawn by Graphics methods may not print correctly. In this case, use the compatible printing method: PrintForm1.Print(Me, PowerPacks.Printing.PrintForm.PrintOption CompatibleModeClientAreaOnly).