PrintForm Class

 

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

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

Inheritance Hierarchy

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

Syntax

[ToolboxBitmapAttribute(typeof(PrintForm), "Microsoft.VisualBasic.PowerPacks.Printing.PrintForm.bmp")]
public class PrintForm : Component
[ToolboxBitmapAttribute((PrintForm^::typeid), "Microsoft.VisualBasic.PowerPacks.Printing.PrintForm.bmp")]
public ref class PrintForm : Component
[<ToolboxBitmapAttribute(typeof(PrintForm), "Microsoft.VisualBasic.PowerPacks.Printing.PrintForm.bmp")>]
type PrintForm = 
    class
        inherit Component
    end
<ToolboxBitmapAttribute(GetType(PrintForm), "Microsoft.VisualBasic.PowerPacks.Printing.PrintForm.bmp")>
Public Class PrintForm
    Inherits Component

Constructors

Name Description
System_CAPS_pubmethod PrintForm()

Initializes a new instance of the PrintForm class.

System_CAPS_pubmethod PrintForm(Form)

Initializes a new instance of the PrintForm class, specifying the Form where it will be parented.

System_CAPS_pubmethod PrintForm(IContainer)

Initializes a new instance of the PrintForm class, specifying the IContainer in which it will be parented.

Properties

Name Description
System_CAPS_protproperty CanRaiseEvents

(Inherited from Component.)

System_CAPS_pubproperty Container

(Inherited from Component.)

System_CAPS_protproperty DesignMode

(Inherited from Component.)

System_CAPS_pubproperty DocumentName

Gets or sets the document name to display (for example, in a print status dialog box or printer queue) while printing the document.

System_CAPS_protproperty Events

(Inherited from Component.)

System_CAPS_pubproperty Form

Gets or sets the form to be printed.

System_CAPS_pubproperty PrintAction

Gets or sets a value indicating whether the output is directed to a printer, to a print preview window, or to a file.

System_CAPS_pubproperty PrinterSettings

Gets or sets a PrinterSettings object that you can use to specify various properties of a printer.

System_CAPS_pubproperty PrintFileName

Gets 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.

System_CAPS_pubproperty Site

(Inherited from Component.)

Methods

Name Description
System_CAPS_pubmethod CreateObjRef(Type)

(Inherited from MarshalByRefObject.)

System_CAPS_pubmethod Dispose()

(Inherited from Component.)

System_CAPS_protmethod Dispose(Boolean)

Releases the unmanaged resources used by a PrintForm component and optionally releases the managed resources.(Overrides Component.Dispose(Boolean).)

System_CAPS_pubmethod Equals(Object)

(Inherited from Object.)

System_CAPS_protmethod Finalize()

(Inherited from Component.)

System_CAPS_pubmethod GetHashCode()

(Inherited from Object.)

System_CAPS_pubmethod GetLifetimeService()

(Inherited from MarshalByRefObject.)

System_CAPS_protmethod GetService(Type)

(Inherited from Component.)

System_CAPS_pubmethod GetType()

(Inherited from Object.)

System_CAPS_pubmethod InitializeLifetimeService()

(Inherited from MarshalByRefObject.)

System_CAPS_protmethod MemberwiseClone()

(Inherited from Object.)

System_CAPS_protmethod MemberwiseClone(Boolean)

(Inherited from MarshalByRefObject.)

System_CAPS_protmethod OnBeginPrint(PrintEventArgs)

Raises the BeginPrint event.

System_CAPS_protmethod OnEndPrint(PrintEventArgs)

Raises the EndPrint event.

System_CAPS_protmethod OnQueryPageSettings(QueryPageSettingsEventArgs)

Raises the QueryPageSettings event.

System_CAPS_pubmethod Print()

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

System_CAPS_pubmethod Print(Form, PrintForm.PrintOption)

Sends an image of a Windows Form to the destination specified by the PrintAction property, specifying the form and printing options

System_CAPS_pubmethod ToString()

(Inherited from Component.)

Events

Name Description
System_CAPS_pubevent BeginPrint

Occurs when the Print method is called, before the first page of the document prints.

System_CAPS_pubevent Disposed

(Inherited from Component.)

System_CAPS_pubevent EndPrint

Occurs when the last page of the document has printed.

System_CAPS_pubevent QueryPageSettings

Occurs immediately before each page is printed.

Remarks

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.

Examples

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

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

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

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