需要帮助打印使用Visual Basic 6打印机对象的点阵打印机 [英] Need help printing in Dot matrix printer with Visual Basic 6 Printer Object

查看:80
本文介绍了需要帮助打印使用Visual Basic 6打印机对象的点阵打印机的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

纸张尺寸为15厘米。打印区域大小为10厘米。如何将标题居中并用10个cms中的数据填充列?它是一种带有穿孔的连续纸。谢谢



从下面的非解决方案复制的附加信息

谢谢。我已经计算了页眉和页脚的高度以及我可以在两者之间获得多少空间。我已将所有内容放入数组并开始在图片框中打印。现在有一个问题。即使我设置了printer.height值,打印机的页面高度(从打印机出来的纸张高度)也保持不变。尽管我更改纸张尺寸/添加新纸张尺寸等,纸张仍然停留在11英寸处。如何在我的页面高度处完全停止打印?谢谢你的时间

The paper size is 15 cms. Print area size is 10 cm. How can I center the title and fill the columns with data fitting in that 10 cms?. It is a continuous paper with perforations. Thank You

addtional information copied from non-solution below
Thanks. I have Calculated the height of header and footer and how much space I can get in between. I have put all contents in an array and started printing it in picturebox. Now there is one problem. The printer's page height (height of the paper which comes out of printer) stays constant even after I set the printer.height value. The paper stops at 11 inches despite me changing the paper size / adding new paper size etc. How can I stop printing at exactly at my page height?? Thank You For Your Time

推荐答案

对于我建议的初始问题...

你可以计算出每个角色用完的宽度取决于在您使用的大小字体上。这将为您提供可以在页面上打印的字符数,然后以(maxchars - textlength)/ 2开始打印文本,或者在前面用很多空格填充它。与列相同的原则。不要认为除了使用点阵式打印机的蛮力之外你还有很多选择。



来自OP的评论似乎有效,但我们现在有了一个新问题...

For the intial problem I suggested ...
You could calculate the width each character will use up depending on the size font you have used. That will give you the number of characters you could print across the page, then start printing your text at (maxchars - textlength) / 2 or pad it with that many spaces at the front. Same principle with the columns. Don't think you have many options other than "brute force" with dot-matrix printers.

From the OPs comment that seems to have worked, but we now have a new issue ...
Tegimus:

好的,我按你的建议做了。现在的问题是内容长度。我需要在页眉和页脚之间打印内容。如果它不适合,请将它放在页眉和页脚之间的下一页。我该如何实现这一目标?谢谢

Okay I have done It the way you suggested. Now the problem is content length. I need to print the contents between header and footer. If it doesn't fit, put it in the next page between header and footer. How can I acheive this? Thank You

所以...



真的相同的原则...只需计算你的页眉和页脚将占用多少物理空间 - 减去从可用的总长度。根据您使用的字体大小计算出可以进入该空间的打印行数 - 记住要向下舍入。



保留一个你的行数正在打印,当你达到极限打印你的页脚,pagethrow,标题,然后从下一行细节开始。



提示:这不是最好的方式做输出,但在像点阵打印机这样的情况下你通常别无选择。对于直到收据等的连续打印机存在类似的(宽度)问题。基本上这是固定格式的打印。我仍然建议尽可能多地参数化信息 - 即根据存储在某处配置中的物理纸张大小计算最大行数。

So ...

Same principle really ... just work out how much physical space your header and footer are going to take - subtract that from the overall length available. Work out how many lines of print you can get into that space given the font size you are using - remember to round down though.

Keep a line count of what you are printing, when you reach the limit print your footer, pagethrow, header and then start with the next line of detail.

Hint: This isn't the best way to do output, but in circumstances like a dot-matrix printer you often have no choice. Similar (width) problems exist for continuous printers for till receipts etc. Essentially this is a fixed-format print. I would still advise trying to parameterise the information as much as possible - i.e. a calculation on max line count based on physical paper size stored in configuration somewhere.


谢谢。我已经计算了页眉和页脚的高度以及我可以在两者之间获得多少空间。我已将所有内容放入数组并开始在图片框中打印。现在有一个问题。即使我设置了printer.height值,打印机的页面高度(从打印机出来的纸张高度)也保持不变。尽管我更改纸张尺寸/添加新纸张尺寸等,纸张仍然停留在11英寸处。如何在我的页面高度处完全停止打印?谢谢您的时间
Thanks. I have Calculated the height of header and footer and how much space I can get in between. I have put all contents in an array and started printing it in picturebox. Now there is one problem. The printer's page height (height of the paper which comes out of printer) stays constant even after I set the printer.height value. The paper stops at 11 inches despite me changing the paper size / adding new paper size etc. How can I stop printing at exactly at my page height?? Thank You For Your Time


这篇关于需要帮助打印使用Visual Basic 6打印机对象的点阵打印机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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