PrintForm.Print Method

Sends an image of a Windows Form to the destination specified by the PrintAction property.

Namespace:  Microsoft.VisualBasic.PowerPacks.Printing
Assembly:  Microsoft.VisualBasic.PowerPacks.Vs (in Microsoft.VisualBasic.PowerPacks.Vs.dll)

public void Print()

The Print method prints all visible objects on the form. This includes any text or graphics drawn with Graphics methods.

By default, only the client area of the form is printed. If a user has resized the form at run time, only the currently visible part of the form will be printed. If the form has been moved so that only a part of it is visible on screen, it will still be printed as if all of the form were visible. To change the default behavior, use the overloaded Print method.

The Print method is backward compatible with the Visual Basic 6.0 PrintForm method.

NoteNote

Only the form that currently has focus can be printed by using this method. If you have set the Form property to another form before calling this method, the image of the form may not be rendered as expected. To avoid this, call the Focus method of the form before you call Print.

The following example prints the current form to the system default printer, printing only the client area at its currently visible size. This example requires that you have a PrintForm component named PrintForm1 on a form.

PrintForm1.PrintAction = Printing.PrintAction.PrintToPrinter
PrintForm1.Print()

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft