启动在运行时打印 Windows 窗体的图像。
继承层次结构
Object
MarshalByRefObject
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 | 获取或设置 Component 的 ISite。 (继承自 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) | 将 Windows 窗体的映像发送到指定的目标PrintAction属性,指定窗体和打印选项 |
![]() |
ToString | 返回包含 Component 的名称的 String(如果有)。不应重写此方法。 (继承自 Component。) |
页首
事件
名称 | 说明 | |
---|---|---|
![]() |
BeginPrint | 发生时Print调用方法时之前打印文档的第一页。 |
![]() |
Disposed | 当通过调用 Dispose 方法释放组件时发生。 (继承自 Component。) |
![]() |
EndPrint | 打印完文档的最后一页时发生。 |
![]() |
QueryPageSettings | 在打印每一页之前立即发生。 |
页首
备注
PrintForm组件,您可以在运行时打印到打印机、 打印预览窗口中,或文件的窗体的图像。 其行为取代了PrintForm在早期版本的 Visual Basic 中的方法。
示例
下面的示例演示的一个常见用途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)