PrintForm 类

启用打印 windows 窗体的图像在运行时。

继承层次结构

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

命名空间:  Microsoft.VisualBasic.PowerPacks.Printing
程序集:  Microsoft.VisualBasic.PowerPacks.Vs(在 Microsoft.VisualBasic.PowerPacks.Vs.dll 中)

语法

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

PrintForm 类型公开以下成员。

构造函数

  名称 说明
公共方法 PrintForm() 初始化 PrintForm 类的新实例。
公共方法 PrintForm(IContainer) 初始化 PrintForm 类的新实例,指定它将父节点的 IContainer
公共方法 PrintForm(Form) 初始化 PrintForm 类的新实例,指定它将父节点的 Form

页首

属性

  名称 说明
受保护的属性 CanRaiseEvents 获取一个指示组件是否可以引发事件的值。 (继承自 Component。)
公共属性 Container 获取 IContainer,它包含 Component。 (继承自 Component。)
受保护的属性 DesignMode 获取一个值,用以指示 Component 当前是否处于设计模式。 (继承自 Component。)
公共属性 DocumentName 获取或设置打印文档时要显示的文档名(例如,在打印状态对话框或打印机队列中显示)。
受保护的属性 Events 获取附加到此 Component 的事件处理程序的列表。 (继承自 Component。)
公共属性 Form 获取或设置要打印的窗体。
公共属性 PrintAction 获取或设置一个输出是否的值的过程,到打印机、打印预览窗口,或者到文件。
公共属性 PrinterSettings 获取或设置可用于指定打印机的各种属性 PrinterSettings 对象。
公共属性 PrintFileName 获取或设置文件将保存一个封装的 PostScript 文件和路径的文件名,当 PrintAction 属性设置为 PrintToFile时。
公共属性 Site 获取或设置 ComponentISite。 (继承自 Component。)

页首

方法

  名称 说明
公共方法 CreateObjRef 创建一个对象,该对象包含生成用于与远程对象进行通信的代理所需的全部相关信息。 (继承自 MarshalByRefObject。)
公共方法 Dispose() 释放由 Component 使用的所有资源。 (继承自 Component。)
受保护的方法 Dispose(Boolean) 释放 PrintForm 元素使用的非托管资源和选择性地释放托管资源。 (重写 Component.Dispose(Boolean)。)
公共方法 Equals 确定指定的对象是否等于当前对象。 (继承自 Object。)
受保护的方法 Finalize 在通过垃圾回收将 Component 回收之前,释放非托管资源并执行其他清理操作。 (继承自 Component。)
公共方法 GetHashCode 用作特定类型的哈希函数。 (继承自 Object。)
公共方法 GetLifetimeService 检索控制此实例的生存期策略的当前生存期服务对象。 (继承自 MarshalByRefObject。)
受保护的方法 GetService 返回一个对象,该对象表示由 Component 或它的 Container 提供的服务。 (继承自 Component。)
公共方法 GetType 获取当前实例的 Type。 (继承自 Object。)
公共方法 InitializeLifetimeService 获取控制此实例的生存期策略的生存期服务对象。 (继承自 MarshalByRefObject。)
受保护的方法 MemberwiseClone() 创建当前 Object 的浅表副本。 (继承自 Object。)
受保护的方法 MemberwiseClone(Boolean) 创建当前 MarshalByRefObject 对象的浅表副本。 (继承自 MarshalByRefObject。)
受保护的方法 OnBeginPrint 引发 BeginPrint 事件。
受保护的方法 OnEndPrint 引发 EndPrint 事件。
受保护的方法 OnQueryPageSettings 引发 QueryPageSettings 事件。
公共方法 Print() 发送 windows 窗体的图像。 PrintAction 属性指定的为目标。
公共方法 Print(Form, PrintForm.PrintOption) 发送 PrintAction 属性设置为目标指定的 windows 窗体的图像,指定窗体和打印选项
公共方法 ToString 返回包含 Component 的名称的 String(如果有)。不应重写此方法。 (继承自 Component。)

页首

事件

  名称 说明
公共事件 BeginPrint 出现问题,则 Print 方法调用,因此,在打印文档的第一页之前。
公共事件 Disposed 当通过调用 Dispose 方法释放组件时发生。 (继承自 Component。)
公共事件 EndPrint 打印完文档的最后一页时发生。
公共事件 QueryPageSettings 在打印每一页之前发生。

页首

备注

PrintForm 元素可以将窗体的图像打印到打印机,、打印预览窗口,或者到文件中。 其行为取代了 Visual Basic 早期版本中 PrintForm 方法的行为。

示例

下面的示例演示 PrintForm 组件的一种常见用法。

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

线程安全

此类型的任何公共 static(在 Visual Basic 中为 Shared) 成员都是线程安全的。但不保证所有实例成员都是线程安全的。

请参见

参考

Microsoft.VisualBasic.PowerPacks.Printing 命名空间

其他资源

PrintForm 组件 (Visual Basic)

如何:使用 PrintForm 组件打印窗体 (Visual Basic)

如何:打印窗体的工作区 (Visual Basic)

如何:打印窗体的工作区和非工作区 (Visual Basic)

如何:打印可滚动的窗体 (Visual Basic)

部署引用 PrintForm 组件的应用程序 (Visual Basic)