打印表格 [英] Printing Forms

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

问题描述

您好,我正在尝试完成看似简单的任务,但到目前为止非常困难.我有一个包含200多个文本框和复选框的表单.该表单很大,并且具有垂直滚动条,供用户查看其整体.我需要列印 这种形式.该表单具有一个停靠在整个表单中的面板,并具有背景图像.需要打印该面板中的图像和所有控件.我可以按比例缩放所有内容并将其绘制为图形图像,但是它只能绘制可见的图像 表格上的否"(不包括向下滚动"部分).不管我尝试什么,都无法打印整个表格.

Hello, I am trying to accomplish what would seem to be a simple task but has been quite difficult so far. I have a form with over 200 textboxes and checkboxes. The form is large and has vertical scroll bars for the user to see it's entirety. I need to print this form. The form has a panel docked filling the whole form and and has a background image. The image and all controls in that panel need to be printed. I can get everything scaled and drawn to a graphic image no problem, but it only draws what is visible on the form (excludes the "scrolled down" portion). No matter what I try I cannot get the entire form to print.

每个人似乎都在使用visualbasic.powerpacks.Printform,但我根本无法使用它.相反,我将所有文本框和复选框放在控件数组中,将它们绘制到位图,缩放比例,然后将它们绘制成单独的形式.

Everyone seems to be using the visualbasic.powerpacks.Printform but I cannot get that to work at all. Instead I put all my textboxes and checkboxes in a control array, draw them to a bitmap, scale them, then draw them to a separate form.

有人知道有关打印大表格的正确方法的任何信息吗?

Anyone have any info regarding proper ways to print a large form?

谢谢!

推荐答案

将面板固定在具有面板上所有控件的窗体中,则实际上不是必需的绘制表格是吗?

Well a Panel docked in a Form with all the controls on the Panel then it isn't really necessary to draw the Form is it?

面板具有 DrawToBitmap方法(位图,矩形),可以打印位图.我相信即使隐藏了面板的某些区域,也可以绘制整个面板,因此可以绘制面板中显示的所有控件.

The Panel has a DrawToBitmap Method (Bitmap, Rectangle) which you can print a Bitmap. I believe even if areas of the Panel are hidden to view it will draw the entire Panel and therefore any controls displayed in the Panel.

但是,打印位图可能会出现问题,因为图像将被分割,但是我想无论位图的很多部分都可以填满要打印的页面.

However printing a Bitmap may have issues as the image will be split I suppose for however many sections of the Bitmap can fill a page being printed to.

除非仅打印以使位图填满一页,否则位图会缩小(可能太小而无法读取数据)或放大(在打印的副本中可能很难看)以仅填满一页.

Unless you only print so that the Bitmap fills a single page so it is shrunk (may be too small to read data) or enlarged (may be ugly in the printed copy) to fill only one page.

保持某些控件显示在特定页面上可能不是一个简单的方法,因此,位图中的任何控件都不会以某种方式被剪切.您不想将TextBox切成两半,所以它的上半部分在一页中,下半部分在下一页中 例如页面.

It's probably not a simple method to maintain that certain controls display on a certain page so no controls in the Bitmap get cut somehow. You wouldn't want to cut a TextBox in half so the upper half of it is in one page and the lower half is in the next page for example.

也许最好设计应用程序,以便在一个面板中有一定数量的控件,在另一个面板中有一定数量的控件,依此类推,以使Panels大小是您要打印到的页面大小.用户不会知道有并置的面板,一个 在另一个上方或一个左侧和一个右侧附近的两个位置上使用,其中一个位于左上方面板下方,而另一个位于右上方面板下方.

Perhaps it would be best to design the app so certan amount of controls are in one panel, certain amount in other panel and so on such that a Panels size is a page size that you want to print to. The user wouldn't know that there are colocated panels, one above the other or one left and one right about two others where one of them is below the top left panel and and the other is below the top right panel, being used.

另一方面,这是美国的周日晚上,其他人将在接下来的几个小时或一两天内提供帮助.

On the other hand it is Sunday night in the U.S. and others will provide assistance in the next few hours or a day or two.

然后再次显示,如果您的纸张尺寸大于或等于面板,则可以一次打印该纸张尺寸的面板.

And then again if you have Paper as large or larger than the Panel you could print the Panel at one time for that Paper size.

对于打印,您可以使用 System.Drawing.Printing 命名空间, PrintDocument类,以及 PrinterSettings类.

For printing you would use the System.Drawing.Printing Namespace, the PrintDocument Class and maybe the PageSettings Class and PrinterSettings Class.

忘记PowerPacks PrintForm的功能,因为它实际上不如其他打印功能那么强大,或者如果您与其他功能一起使用足以学习它们,通常是必需的.另外,您必须在您的系统上安装PowerPack 该应用程序将安装在您的应用程序上,或提供与该应用程序一起使用的.Dll.

Forget about the PowerPacks PrintForm ability as it's really not as capable as the other print capabilites or necessary typically if you work with the other capabilities enough to learn them. Plus you either have to install PowerPacks on a system your app would be installed on or provide the .Dlls it uses with your app.


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

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