获取或设置显示是否直接输出到打印机、打印预览窗口或者到某个文件的值。
命名空间: Microsoft.VisualBasic.PowerPacks.Printing
程序集: Microsoft.VisualBasic.PowerPacks.Vs(在 Microsoft.VisualBasic.PowerPacks.Vs.dll 中)
语法
声明
<BrowsableAttribute(True)> _
Public Property PrintAction As PrintAction
[BrowsableAttribute(true)]
public PrintAction PrintAction { get; set; }
[BrowsableAttribute(true)]
public:
property PrintAction PrintAction {
PrintAction get ();
void set (PrintAction value);
}
[<BrowsableAttribute(true)>]
member PrintAction : PrintAction with get, set
function get PrintAction () : PrintAction
function set PrintAction (value : PrintAction)
属性值
类型:PrintAction
返回PrintAction枚举。
备注
当PrintToPrinter是选择,将输出定向到系统的默认打印机。 您可以覆盖此行为,并使用显式设置打印机和打印机属性PrinterSettings属性。 如果没有默认打印机可用,则提示用户选择一台打印机。
当PrintToPreview是选择,则显示的格式标准的 Windows 窗体中PrintPreviewDialog控件。
当PrintToFile是选择,窗体的映像保存到某一内嵌的 PostScript 文件 (.eps、.ps 或.ai) 在指定的路径PrintFileName属性。 如果不指定任何文件的名称,则用户是系统提示您输入文件的名称。
备注
文件将保存在 8 位灰度 PostScript 格式。不支持 24 位 RGB PostScript。
备注
不提示用户输入的路径或文件扩展名。若要确保该文件具有有效的路径和扩展插件,您可以实现您自己的对话框。若要执行此操作,使用SaveFileDialog组件,然后将分配到的返回值PrintFileName属性之前调用Print方法。
示例
下面的示例演示如何设置PrintAction属性。 此示例要求您有PrintForm名为 PrintForm1 和三个组件RadioButton窗体上的控件。
If RadioButton1.Checked = True Then
PrintForm1.PrintAction = Printing.PrintAction.PrintToPrinter
ElseIf RadioButton2.Checked = True Then
PrintForm1.PrintAction = Printing.PrintAction.PrintToPreview
Else
PrintForm1.PrintFileName = _
My.Computer.FileSystem.SpecialDirectories.CurrentUserApplicationData _
& "Form1.eps"
PrintForm1.PrintAction = Printing.PrintAction.PrintToFile
End If
.NET Framework 安全性
- 对直接调用方的完全信任。此成员不能由部分信任的代码使用。有关详细信息,请参阅通过部分受信任的代码使用库。
请参阅
参考
Microsoft.VisualBasic.PowerPacks.Printing 命名空间
其他资源
如何:使用 PrintForm 组件打印窗体 (Visual Basic)