无论用户的屏幕分辨率如何,都将表格打印到A4纸上 [英] Print a form onto A4 paper regardless of the users screen resolution

查看:69
本文介绍了无论用户的屏幕分辨率如何,都将表格打印到A4纸上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个Windows窗体(在VB中),使用PrintForm和PowerPacks.Printing.PrintForm.PrintOption.ClientAreaOnly打印到A4纸上。当我的笔记本电脑连接到我的24英寸显示器时工作正常,但当我断开连接时,我发现当我打印它时,它会切断表格的底部。看起来PrintForm只打印到屏幕的总高度,因为我的笔记本电脑分辨率较低,它会中断。



表格上有各种项目(按钮,图像,表格等)在表格上都高,所以打印正确,但我的底部有一个页脚,在较低的分辨率下被切断。可能是因为更改分辨率会调整屏幕上的形式,这是导致底部被切断的原因?是否有可能有一个更大的屏幕高度的形式(例如滚动)



我见过几种方法,人们说可以解决这个但不确定哪一个最适合这个问题。有人有什么想法吗?



谢谢

Garry

I have created a Windows form (in VB) which prints onto A4 paper using PrintForm and PowerPacks.Printing.PrintForm.PrintOption.ClientAreaOnly. This works fine when my laptop is connected to my 24 inch monitor but when I disconnect it I discovered that when I printed it cut the bottom of the form off. It looks like the PrintForm only prints up to the total height of the screen, and as my laptop resolution is lower it cuts off.

The form has various items on (buttons, images, tables etc) which are all high up on the form so print correctly but I have a 'footer' at the bottom which is getting cut off on the lower resolution. It may be that changing the resolution resizes the form on screen which is the cause of the bottom getting cut off? Is it possible to have a form larger that the screen height (scrolling for example)

I've seen a couple of methods which people say may resolve this but not sure which one would be best for this problem. Anybody got any ideas?

Thanks
Garry

推荐答案

最好的解决方案是停止使用PrintForm并使用 PrintDocument [ ^ ]

它允许您以独立于屏幕的方式指定布局,并决定一切看起来如何,无论屏幕分辨率如何。这是更多的工作,但它产生了更好的结果。
The best solution is to stop using PrintForm and to use a PrintDocument[^] instead.
It allows you to specify the layout in a screen independent manner, and decide how everything looks regardless of screen resolution. It's more work, but it produces much better results.


感谢回复Griff。



只是为了仔细检查这是最好的方法,我的表格包含一个表,按钮和一个图片框加上几个标签和文本框。我是否会将PrintDocument添加到我的表单中,然后使用e.Graphics.DrawString(对象等)单击打印按钮时指定页面上每个项目的位置?



谢谢

Garry
Thanks for the reply Griff.

Just to double check this is the best method, my form contains a table, buttons and a picture box plus several labels and text boxes. Would I add the PrintDocument to my form and then specify the location of each item on the page when the 'print' button is clicked using the e.Graphics.DrawString(object, etc)?

Thanks
Garry


这篇关于无论用户的屏幕分辨率如何,都将表格打印到A4纸上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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