如何在 vb.net 2010 中打印表格?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/16032275/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-17 13:16:29  来源:igfitidea点击:

How to print a form in vb.net 2010?

vb.netformsprinting

提问by user2214648

I would like to print a form with a scrollable datagridview table. But I'm getting an empty file in *.docx.

我想打印一个带有可滚动 datagridview 表的表单。但我在 *.docx 中得到一个空文件。

回答by jordanhill123

From MSDN - PrintForm Component (Visual Basic)

来自MSDN - PrintForm 组件 (Visual Basic)

' For Direct Printing to a Printer
Dim pf As New PrintForm
pf.Form = Me
pf.PrintAction = PrintToPrinter
pf.Print()

See MSDN - Print a Form by Using the PrintForm Component for Print to File options.

请参阅MSDN - 使用打印到文件选项的 PrintForm 组件打印表单