如何在vb.net中设置打印数据 [英] how to set print data in vb.net

查看:254
本文介绍了如何在vb.net中设置打印数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

全部好,



我想在vb.net中打印一些来自datagridview的数据,一些来自标签,一些来自文本框,一些来自字母标题,任何人有没有想法?,提前很感激。

HI all,

I would like to print data in vb.net some from datagridview, some from label,some from textbox and some from letter header, anyone has idea?, much appreciate in advance.

推荐答案

首先,打印控件不是一个好主意,因为它会违反数据和表示之间的隔离。如果打印和UI的循环在所有情况下都是相同的,那么它会被找到,但通常情况并非如此。



例如,成像打印一些复选框。什么,有人应该在纸上点击它们?打印的演示文稿通常与屏幕上的UI略有不同。媒体非常不同。打印排列在纸张上,与屏幕截然不同。



因此,隔离数据层或数据模型总是好的。在这种情况下,您可以打印和显示来自同一数据层的数据,但不能从scree打印。



基本上,使用类 PrintDocument

http: //msdn.microsoft.com/en-us/library/system.drawing.printing.printdocument.aspx [ ^ ]。



你会发现很清楚上面引用的帮助页面末尾的代码示例。



-SA
First of all, printing the control is not such a good idea, because it would violate the isolation between data and presentation. If printing and the loop of UI could be identical in all cases, it would be find, but usually, this is not the case.

For example, imaging you print some check boxes. What, someone should click them on paper? Printed presentation is usually somewhat different from the on-screen UI. The media is very different. Print is arranges on the piece of paper, which is very different from screen.

Therefore, it''s always good to isolate data layer, or data model. In this case, you can print and present data from the same data layer, but not print from scree.

Basically, use the class PrintDocument:
http://msdn.microsoft.com/en-us/library/system.drawing.printing.printdocument.aspx[^].

You will find a very clear code sample at the end of the help page referenced above.

—SA


这篇关于如何在vb.net中设置打印数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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