如何打印文本框的内容文本框、内容

2023-09-03 00:47:00 作者:胸小似我爸

如何打印在地铁的应用程序文本框的内容是什么?我已阅读 MSDN上和许多在线教程本快速入门指南,但他们是非常复杂和不与TextBox控件的工作,只RichTextBox的的控制

How do I print the contents of a TextBox in metro apps? I have read this quickstart guide on MSDN and many online tutorials, but they are very complicated and do not work with TextBox controls, only RichTextBox controls.

我们如何从地铁应用程序中的文本框控件打印?它甚至有可能?怎么样?

How do we print from a TextBox control in a metro app? Is it even possible? How?

推荐答案

更新1

我已经创建了简化打印文本框内容的辅助类。您可以通过的NuGet 添加辅助类。如果你想提高我的现有的辅助类,叉子 GitHub上

I have created a helper class which simplifies printing text box content. You can add helper class via NuGet. If you want to enhance my existing helper class, fork on GitHub

在这里,我给你的修改的打印样本从MSDN。我已经把文本框,你可以写任何东西,将被打印出来。请注意,我没有做样品用于打印的文本框的文字完全一样,因为它是即格式(粗体,斜体,下划线,颜色)。我已经设置硬codeD打印格式。你可以让你自己的格式。

Here I am giving you the modified print sample from MSDN. I have put textbox you can write anything and that will be printed. Please note I have not done sample which prints textbox text exactly same as it is i.e formatting (bold, italic, underline, colors). I have set hard-coded print format. You can make your own format.

堆栈溢出,字符数限制的答案,我的code是太长所以发帖codePaste.net链接。

Stack Overflow has character limit in answer and my code is too long so posting CodePaste.net links.

XAML: HTTP://$c$cpaste.net/9nf261

CS: HTTP://$c$cpaste.net/q3hsm3

请注意,我已经使用了一些图像,以便把图片中的图像文件夹

Please note that I have used some images so put images in "Images" folder