限制多行文本框输入,以便打印所有内容 [英] Limiting a multi-line text box input so that everything will be printed

查看:27
本文介绍了限制多行文本框输入,以便打印所有内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我确定这是一个常见问题,不知道有没有通用的解决方案.我的问题是当用户在 GUI 中查看所述多行文本框时,他们可以向下滚动,这不是问题.但是,当我开始打印时,某些文本有时会超出该文本框给定区域的底部.

I'm sure this is a common problem, I don't know if there is a common solution. My problem is when the user is viewing said multi-line text box in the GUI they can just scroll down, not a problem. When I come to print however, certain text occasionally ends up going off the bottom of the given area for that text box.

我们会保持简单并说它不是富文本框,因此用户无法选择较大的字体,因此可能会脱离页面.哼哼,如果我需要的话,请交叉那个新娘 =)

We'll keep it simple and say it is not a rich text box so the user can't choose a larger font which may therefore go off the page. hmmph cross that bride if I need to =)

所以我考虑过;

使用字符限制,但如果您只是多次回车,这最终会超出底部.

Using a character limit but then if you just return carriage a number of times, this would end up going off the bottom.

或者我不完全确定如何实施但似乎也不正确的行"限制

Or a 'row' limit which i'm not entirely sure how to implement but didn't seem right either

最后我得出的结论是,当您打印所述多行文本框时,您必须扩展打印文档上的区域以适合输入的任何文本.如果这是最优雅的解决方案,有人能指出我实现此类功能的正确方向吗?

Finally I am coming to the conclusion that when you print said multi-line text box you must just expand the area on the printed document to fit whatever text has been entered. If this is the most elegant solution can anybody point me in the right direction for implementing such a feature?

考虑一个注释字段,用户可以在其中输入任意数量的内容,目的是确保打印所有输入的内容.

Think of a notes field where the user could type as much as they wanted and the intention is to make sure all that is typed is printed.

推荐答案

你在调用 yourTextBox.DrawToBitMap 吗?所做的只是创建显示在屏幕上的位图,它不会执行打印机输出、行布局、换行、打印机字体、边距、方向、分页或任何其他与打印有关的操作.

Are you calling yourTextBox.DrawToBitMap? All that does is create a bitmap of what appears on the screen, it does not perform printer output, line layout, line breaks, printer fonts, margins, orientation, pagination, or anything else to do with printing.

如果您想将文本发送到打印机,处理上述所有功能,则必须使用 System.Drawing.Printing.PrintDocument 类并处理打印机需要的所有内容文本框为您服务.

If you want to send text to a printer, handling all the features mentioned above, you will have to use the System.Drawing.Printing.PrintDocument class and deal with all the things printers require that textBoxes do for you.

这篇关于限制多行文本框输入,以便打印所有内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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