如何打印子表格. [英] How can I print the child form.

查看:81
本文介绍了如何打印子表格.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在主窗体上有一个按钮,它将打开子窗体.现在,我要打印该子表格,该怎么做?

I have a button on the main Form, which opens the child Form. Now, I want to print that child form, how can I do that?

推荐答案

不,您不打开子表格;表单之间没有子/父母关系.有所有权和所有者形式;我建议您通过将所有非主要表单都归一个主要表单使用来使用它.

现在,打印.不要打印表格,打印用于填充表格控件的数据;为此,您需要一些数据层.在所有情况下,请使用类System.Drawing.Printing.PrintDocument.

该帮助页面包含一个简单的代码示例,使您可以很好地了解用法: http://msdn.microsoft.com/en-us/library/system.drawing.printing.printdocument.aspx [
No, you don''t open a child form; there is no child/parent relationships between forms. There are owned and owner forms; and I advice you use it by making all non-main forms owned by a main form.

Now, printing. Don''t print the form, print the data used to populate the form''s control; for that purpose, you need some data layer. In all cases, use the class System.Drawing.Printing.PrintDocument.

This help page contains a simple code sample which gives you a good idea of the usage: http://msdn.microsoft.com/en-us/library/system.drawing.printing.printdocument.aspx[^].

—SA


这两个链接应该可以帮助您-
http://www.c-sharpcorner.com/UploadFile/srajlaxmi/PrintingWindowsForm01182008021239AM/PrintingWindowsForm.aspx [ ^ ]
http://social.msdn.microsoft.com/Forums/en/winforms/thread/b1d9c023-8032-48f8-8092-dbc976607081 [
These two links should help you out -
http://www.c-sharpcorner.com/UploadFile/srajlaxmi/PrintingWindowsForm01182008021239AM/PrintingWindowsForm.aspx[^]
http://social.msdn.microsoft.com/Forums/en/winforms/thread/b1d9c023-8032-48f8-8092-dbc976607081[^]


这篇关于如何打印子表格.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆