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)

Syntax

public void Print()
public:
void Print()
member Print : unit -> unit
Public Sub Print

Remarks

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.

Note

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.

Examples

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()

See Also

Print Overload
PrintForm Class
Microsoft.VisualBasic.PowerPacks.Printing Namespace
PrintForm Component (Visual Basic)
How to: Print a Form by Using the PrintForm Component (Visual Basic)
How to: Print the Client Area of a Form (Visual Basic)
How to: Print Client and Non-Client Areas of a Form (Visual Basic)
How to: Print a Scrollable Form (Visual Basic)
Deploying Applications That Reference the PrintForm Component (Visual Basic)

Return to top