PrintForm Class

Enables printing an image of a Windows Form at run time.

System.Object
  System.MarshalByRefObject
    System.ComponentModel.Component
      Microsoft.VisualBasic.PowerPacks.Printing.PrintForm

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

[ToolboxBitmapAttribute(typeof(PrintForm), "Microsoft.VisualBasic.PowerPacks.Printing.PrintForm.bmp")]
public class PrintForm : Component

The PrintForm type exposes the following members.

  NameDescription
Public methodPrintForm()Initializes a new instance of the PrintForm class.
Public methodPrintForm(IContainer)Initializes a new instance of the PrintForm class, specifying the IContainer in which it will be parented.
Public methodPrintForm(Form)Initializes a new instance of the PrintForm class, specifying the Form where it will be parented.
Top

  NameDescription
Protected propertyCanRaiseEventsGets a value indicating whether the component can raise an event. (Inherited from Component.)
Public propertyContainerGets the IContainer that contains the Component. (Inherited from Component.)
Protected propertyDesignModeGets a value that indicates whether the Component is currently in design mode. (Inherited from Component.)
Public propertyDocumentNameGets or sets the document name to display (for example, in a print status dialog box or printer queue) while printing the document.
Protected propertyEventsGets the list of event handlers that are attached to this Component. (Inherited from Component.)
Public propertyFormGets or sets the form to be printed.
Public propertyPrintActionGets or sets a value indicating whether the output is directed to a printer, to a print preview window, or to a file.
Public propertyPrinterSettingsGets or sets a PrinterSettings object that you can use to specify various properties of a printer.
Public propertyPrintFileNameGets or sets the file name of an Encapsulated PostScript file and the path to which the file will be saved when the PrintAction property is set to PrintToFile.
Public propertySiteGets or sets the ISite of the Component. (Inherited from Component.)
Top

  NameDescription
Public methodCreateObjRefSecurity Critical. Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object. (Inherited from MarshalByRefObject.)
Public methodDispose()Releases all resources used by the Component. (Inherited from Component.)
Protected methodDispose(Boolean)Releases the unmanaged resources used by a PrintForm component and optionally releases the managed resources. (Overrides Component.Dispose(Boolean).)
Public methodEqualsDetermines whether the specified object is equal to the current object. (Inherited from Object.)
Protected methodFinalizeReleases unmanaged resources and performs other cleanup operations before the Component is reclaimed by garbage collection. (Inherited from Component.)
Public methodGetHashCodeServes as the default hash function. (Inherited from Object.)
Public methodGetLifetimeServiceSecurity Critical. Retrieves the current lifetime service object that controls the lifetime policy for this instance. (Inherited from MarshalByRefObject.)
Protected methodGetServiceReturns an object that represents a service provided by the Component or by its Container. (Inherited from Component.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Public methodInitializeLifetimeServiceSecurity Critical. Obtains a lifetime service object to control the lifetime policy for this instance. (Inherited from MarshalByRefObject.)
Protected methodMemberwiseClone()Creates a shallow copy of the current Object. (Inherited from Object.)
Protected methodMemberwiseClone(Boolean)Creates a shallow copy of the current MarshalByRefObject object. (Inherited from MarshalByRefObject.)
Protected methodOnBeginPrintRaises the BeginPrint event.
Protected methodOnEndPrintRaises the EndPrint event.
Protected methodOnQueryPageSettingsRaises the QueryPageSettings event.
Public methodPrint()Sends an image of a Windows Form to the destination specified by the PrintAction property.
Public methodPrint(Form, PrintForm.PrintOption)Sends an image of a Windows Form to the destination specified by the PrintAction property, specifying the form and printing options
Public methodToStringReturns a String containing the name of the Component, if any. This method should not be overridden. (Inherited from Component.)
Top

  NameDescription
Public eventBeginPrintOccurs when the Print method is called, before the first page of the document prints.
Public eventDisposedOccurs when the component is disposed by a call to the Dispose method. (Inherited from Component.)
Public eventEndPrintOccurs when the last page of the document has printed.
Public eventQueryPageSettingsOccurs immediately before each page is printed.
Top

The PrintForm component enables you to print an image of a form to a printer, to a print preview window, or to a file at run time. Its behavior replaces that of the PrintForm method in earlier versions of Visual Basic.

The following example shows a common use of the PrintForm component.

Dim pf As New PrintForm
pf.Form = Me
pf.PrintAction = PrintToPrinter
pf.Print()

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft