如何打印可滚动的用户控件表单 [英] How to print scrollable user control form
本文介绍了如何打印可滚动的用户控件表单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个用户控制页面,我有一些图表和标签。我想要打印整个可滚动页面。
我尝试过:
我用过:
I have one user control page and i have some charts and labels on it. I want to print the whole scrollable page.
What I have tried:
I used :
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
PrintForm1.Print(Me, PowerPacks.Printing.PrintForm.PrintOption.Scrollable)
End Sub
但我收到的错误为
类型'userctrl'的值无法转换为'System.Windows.Forms.Form'。
but i got the error as
"value of type 'userctrl' cannot be converted to 'System.Windows.Forms.Form'".
推荐答案
使用PrintDocument: PrintDocument Class(System.Drawing.Printing) [ ^ ] - 它可以让您准确指定打印的内容和位置。使用PrintForm并不是那么简单,但这就是重点:PrintForm只打印当时用户可见的内容 - 您需要打印不可见的内容。该链接包含一个基本示例,但这里有一个更复杂的链接:将参数传递给PrintDocument.PrintPage事件 [ ^ ]代码在C#中,但它非常简单,如果你无法应对,在线转换器应该很好地解决它。
Use a PrintDocument: PrintDocument Class (System.Drawing.Printing)[^] - it lets you specifiy exactly what is printed, and where. It's not as trivial to use as PrintForm, but that's the whole point: PrintForm only prints what it visible to the user at that moment - you need to print the stuff that isn't visible as well. The link includes a basic example, but there is a more complex one here: Passing Parameters to a PrintDocument.PrintPage Event[^] The code is in C# but it's pretty simple, and online converters should tanslate it pretty well if you can't cope.
这篇关于如何打印可滚动的用户控件表单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文